3scale_toolbox icon indicating copy to clipboard operation
3scale_toolbox copied to clipboard

Latest proxy config for all services with a given gateway host

Open eguzki opened this issue 5 years ago • 0 comments

Export proxy configuration command can be enhanced providing some gateway host parameter.

3scale API provides an endpoint that returns the latest proxy config for all services that share a gateway host. Just a single request:

GET /admin/api/services/proxy/configs/{ENVIRONMENT}.json?host=HOST
{
  "proxy_configs" : [
    {
      "proxy_config": { ... }
     },
     {
      "proxy_config": { ... }
     }      
  ]
}

Needs new public method in the 3scale-api-ruby library. Something like this:

 # @api public                                                                                       
 # @return [Array]                                                                                    
 # @param [String] host Gateway Host                                                             
 # @param [String] environment. Must be 'sandbox' or 'production'                                    
 def proxy_config_list_by_host(host, environment = 'sandbox')                                        
   params = { host: host }                                                                           
   response = http_client.get("/admin/api/services/proxy/configs/#{environment}", params: params)    
   extract(collection: 'proxy_configs', entity: 'proxy_config', from: response)                      
 end                                                                                                 

Note: When services share a gateway host, APICAST_PATH_ROUTING has to be enabled.

eguzki avatar Jun 10 '20 13:06 eguzki