You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Related JIRAs

Unable to render Jira issues macro, execution error.

Unable to render Jira issues macro, execution error.

Goal

Currently, the Admin API allows management and access to topologies, descriptors, and provider configurations but does not provide access to the Service Definitions for the proxied services.

The goal is to expand the Admin API to include service definitions and allow for customization through the API: we should be able to create, read, update and delete service definitions including both service and rewrite XML files. Changes made via the new API should target topology file redeployment that is referencing the changed service definition.

How to fetch service definitions

A service definition in Knox consists of two following major parts:

  • service descriptor: identifies and described the service with name/role/version. This is specified in a file named service.xml  under GATEYAY_DATA_DIR/services/$service/$version folder.
  • rules: specifies the list of rewrite rules - read from rewrite.xml - belong to the given service/role/version. This is optional, in case there are no rewrite rules for the given service you will not see any XML element/JSON data with the name 'rules'.

All of the below fetch operations will provide you a result with the following structure:

  • as XML
    <serviceDefinitions>
<serviceDefinition>
<service name="..." role="..." version="...">
...
</service>
<rules>
...
</rules>
</serviceDefinition>
<serviceDefinition>
...
<serviceDefinition>
...
</serviceDefinitions>
  • as JSON
    {
   "serviceDefinitions" : {
      "serviceDefinition" : [ {
         "service" : {
            "name" : "...",
            "role" : "...",
            "version" : "...",
...
         },
         "rules" : {
...
}
}, {
         "service" : {
         },
         "rules" : {
      } ]
   }
}

To read an existing service definition or a list of service definitions you should send a GET request to one of the following REST API endpoints:

Fetching all service definitions:

https://{gateway-host}:{gateway-port}/{gateway-path}/admin/api/v1/servicedefinitions

Sample:  curl -ku admin:admin-password -H "Accept: application/json" -X GET 'https://localhost:8443/gateway/admin/api/v1/servicedefinitions/'


Fetching all service definitions for a particular service:

https://{gateway-host}:{gateway-port}/{gateway-path}/admin/api/v1/servicedefinitions/{serviceName}

Sample:

Fetching all service definitions for a particular service and role:

https://{gateway-host}:{gateway-port}/{gateway-path}/admin/api/v1/servicedefinitions/{serviceName}/{roleName}

Sample:

Fetching a service definition for a particular service, role and version:

https://{gateway-host}:{gateway-port}/{gateway-path}/admin/api/v1/servicedefinitions/{serviceName}/{roleName}/{version}

Sample:

How to add a new service definition

How to update existing service definitions

Service Definition Management in the Admin UI

  • No labels