Cloud Services

Enterprise Marketplace

Dynamic data fetching from external systems
Published On Oct 08, 2024 - 8:47 AM

Dynamic data fetching from external systems

Explains how to fetch data from Terraform providers that are not available out-of-the-box (OOTB).
Enterprise Marketplace fetches all needed data from the providers that are available out of the box automatically. However, Terraform providers that are not available OOTB require a little more work to fetch the data. This procedure allows you to set up the system to dynamically fetch the proper values for a field based on the configuration value of the parent. The data can be retrieved from an external source or from an internal function and the child values are populated based on the parent field.
For example, you might want your users to select an availability zone in their country and region. Instead of having a single drop-down menu that lists every availability zone in the world, you can instead have a field that allows them to select their country. The system can then populate the Region field with only those regions in that country. Similarly, selecting a region populates the Availability Zone drop-down menu with zones from the selected region. This method allows the user to select from a limited range of values, speeding up the selection process and reducing the chance of error.

Procedure

To dynamically fetch data, you must create an external Service Configuration key and then link it to data using an API using these steps. The value will be fetched and appear in the new attribute field when your users order the catalog. These procedures vary based on whether your tenant uses the V3 authorization model.
  1. Open the catalog that you want to add dynamic data for in Catalog Management. You can also perform these steps during the creation of a catalog.
  2. Click the
    Configuration Parameters
    tab.
  3. Click the
    Actions
    icon and select
    Add Attribute
    .
  4. Create the attribute as normal. For
    Parameter Values & Context Combinations
    , select
    Derived from External Source
    .
  5. Add the schema as shown below into the
    Derived Value Metadata
    field:
    { “externalServiceConfigurationKey”:”get-availability-zones”, “derivedFrom”:[“region”] }
    Where:
    • externalServiceConfigurationKey is set by the user, but must be unique in the tenant.
    • derivedFrom is the configID of the parent of the attribute, in this example region.
  6. Create the API payload using the following format:
    { "configurationkey": "get-availability-zones" "configurationvalue: { "endpoint": the endpoint of the API you want to call "method": The method of the API you want to call "_headers": { Add any headers that are required by the API, such as credentials. } } }
    Where:
    • configurationkey is a unique key that contains information related to external adapter such as the endpoint and headers. The key provided here should be same as externalServiceConfigurationKey provided in step 5.
    • endpoint is the adapter URL or any external URL that fetches the dynamic values for the config attribute.
    • _headers contains headers related to authentication such as username, apikey, and bearer token.
  7. Navigate to the
    Developer Console
    . To learn more about navigating to the different services from each tenant, refer to Landing page navigation or Kyndryl Bridge Landing page navigation.
  8. In the
    Application
    field, select
    consume
    for non-V3 tenants, or
    EMP
    for V3 tenants.
  9. In the
    Service
    field, select
    Consume common API
    (non-V3 tenants) or
    consume_common_api
    (V3 tenants).
  10. In the
    Configuration API
    section, select
    POST /common/v1/configs
    for both non-V3 and V3 tenants.
  11. Paste the API payload that you created in the
    payload
    parameter field and click
    Execute
    .

Known limitations

The following are the known limitations for fetching dynamic data:
  1. The APIs present over private network or APIs present in different network cannot be called using this feature. Forward proxy implementation is not supported currently. The feature only supports public APIs or APIs available in same network.
  2. This feature is not supported for the SP-CT model.
  3. Provisioning Policies and Load Values on the
    View Details
    tab of the configuration attribute on Catalog Management do not work.
  4. At least one valid configId must be added in the
    derivedFrom
    attribute in
    Derived From Ext Source
    metadata.

Required payloads

The external adapter/API should accept the payload in the following format.
{ "dependentConfigId": [ --- "dependentSectionCodes" is also supported in place of "dependentConfigId". "string", "string" ], "parentConfigs": [ { "parentConfigId": "string", "values": [ { "valueId": "string", "label": "string" } ] } ], "contexts": [ { "tagType": "", "tagName": "", "tagValue": "", "tagValueCode": "" } ] }
The external adapter/API should return the response in the following format.
{ "configGroup": [ { "configGroupName": "string", "configGroupCode": "string", "configGroupSequence": 0, "callForValidate": false, "visibilityRules": [ { "configId": "string", "hideExpression": "string" } ], "sections": [ { "sectionName": "string", "sectionCode": "string", "callForValidate": false, "sectionSequence": 0, "max": 49, "isRemovable": true, "configs": [ { "configId": "string", "configName": "string", "sequence": 0, "description": "string", "isRequired": true, "isSelected": false, "callForValidate": false, "dataType": "string", "binding": "string", "editable": true, "configEditable": true, "range": { "min": 0, "max": 0, "step": 0 }, "values": [ { "valueId": "string", "label": "string" } ], "default": { "valueId": "string", "label": "string" }, "inputType": "freetext", "minSize": 0, "maxSize": 0, "validation": "string", "searchInfo": { "keys": [ { "keyId": "string", "keyLabel": "string" } ] }, "derives": [ { "configId": "string", "valueMap": [ { "parentValueId": "string", "dependentValues": [ { "valueId": "string", "label": "string" } ] } ], "callForUpdate": true } ], "errorMessage": "string" } ] } ], "fixedSectionItems": [ { "sectionItemSequence": 0, "configId": "string", "fixedValues": [ { "valueId": "string", "label": "string" } ] } ], "configs": [ { "configId": "string", "configName": "string", "sequence": 0, "description": "string", "isRequired": true, "isSelected": false, "callForValidate": false, "dataType": "string", "binding": "string", "editable": true, "configEditable": true, "range": { "min": 0, "max": 0, "step": 0 }, "values": [ { "valueId": "string", "label": "string" } ], "default": { "valueId": "string", "label": "string" }, "inputType": "freetext", "minSize": 0, "maxSize": 0, "validation": "string", "searchInfo": { "keys": [ { "keyId": "string", "keyLabel": "string" } ] }, "derives": [ { "configId": "string", "valueMap": [ { "parentValueId": "string", "dependentValues": [ { "valueId": "string", "label": "string" } ] } ], "callForUpdate": true } ], "errorMessage": "string" } ] } ], "reasons": [ { "statusCode": 0, "status": "string", "messages": [ "string" ] } ] }
Do you have two minutes for a quick survey?
Take Survey