Class RestApiAdminService


  • public class RestApiAdminService
    extends Object
    • Constructor Detail

      • RestApiAdminService

        public RestApiAdminService()
    • Method Detail

      • addApi

        public boolean addApi​(APIData apiData)
                       throws APIException
        Adds an API with the metadata passed in.
        Parameters:
        apiData - Object model of the API to be added
        Returns:
        Status of the execution of adding the API
        Throws:
        APIException - Is thrown if an anomaly is encountered while adding the given API
      • addApiForTenant

        public boolean addApiForTenant​(APIData apiData,
                                       String tenantDomain)
                                throws APIException
        Adds an API with the metadata passed in.
        Parameters:
        apiData - Object model of the API to be added
        tenantDomain - Domain name of the tenant to which the API should be added
        Returns:
        Status of the execution of adding the API
        Throws:
        APIException - Is thrown if an anomaly is encountered while adding the given API
      • addApiFromString

        public boolean addApiFromString​(String apiData)
                                 throws APIException
        Adds an API with the configuration passed in, as a string.
        Parameters:
        apiData - API configuration to be added, as a string
        Returns:
        Status of the execution of adding the API
        Throws:
        APIException - Is thrown if an anomaly is encountered while adding the given API
      • addApiForTenant

        public boolean addApiForTenant​(String apiData,
                                       String tenantDomain)
                                throws APIException
        Sets the tenant domain when a publisher publishes his API in MT mode. When publisher publishes the API, we login the gateway as super tenant. But we need to publish the API in the particular tenant domain.
        Parameters:
        apiData - API configuration as a string
        tenantDomain - Target tenant domain
        Returns:
        A boolean with the status of adding the API
        Throws:
        APIException
      • getApiForTenant

        public APIData getApiForTenant​(String apiName,
                                       String tenantDomain)
                                throws APIException
        Sets the tenant domain when a publisher tries to retrieve API his API in MT mode. When publisher gets the API, we login the gateway as super tenant. But we need to get the API,which is in the particular tenant domain.
        Parameters:
        apiName - Name of the API to be retrieved
        tenantDomain - Target tenant domain
        Returns:
        Retrieved API configuration as an object model
        Throws:
        APIException
      • getApiByName

        public APIData getApiByName​(String apiName)
                             throws APIException
        Retrieves API configuration mapped into the name passed in.
        Parameters:
        apiName - Name of the API to be retrieved
        Returns:
        An Instance of APIData containing the metadata related to the underlying API configuration
        Throws:
        APIException - Is thrown if an error encountered while retrieving the synapse configuration
      • updateApiFromString

        public boolean updateApiFromString​(String apiName,
                                           String apiData)
                                    throws APIException
        Updates a given API configuration passed in as a string.
        Parameters:
        apiName - Name of the API to be updated
        apiData - API configuration to be updated, as a string
        Returns:
        Status of the execution of updating the given API configuration
        Throws:
        APIException - Is thrown if an anomaly is encountered while updating the given API
      • updateApiForTenant

        public boolean updateApiForTenant​(String apiName,
                                          String apiData,
                                          String tenantDomain)
                                   throws APIException
        Set the tenant domain when a publisher updates his API in MT mode. When publisher updates the API, we login the gateway as super tenant. But we need to update the API,which is in the particular tenant domain.
        Parameters:
        apiName - Name of the API
        apiData - API configuration to be updated as a string
        Returns:
        A boolean indicating if the update is successful
        Throws:
        APIException
      • deleteApi

        public boolean deleteApi​(String apiName)
                          throws APIException
        Deletes an API that carries the name that is passed in.
        Parameters:
        apiName - Name of the API to be deleted
        Returns:
        Status of the execution of deleting the given API
        Throws:
        APIException - Is thrown if an anomaly is encountered while deleting the given API
      • deleteApiForTenant

        public boolean deleteApiForTenant​(String apiName,
                                          String tenantDomain)
                                   throws APIException
        Deletes an API that exists in the space of a given tenant, carrying the name passed in.
        Parameters:
        apiName - Name of the API to be deleted
        tenantDomain - Domain name of the tenant which the API belongs to
        Returns:
        Status of the execution of deleting the given API
        Throws:
        APIException - Is thrown if an anomaly is encountered while deleting the given API