DIY Exercise 5-2: Use an API implementation as its own proxy
Time estimate: 1 hour
Objectives
In this exercise, you configure a Mule application that has already deployed to CloudHub to manage its own API proxies. You will:
· Configure a Mule application to enable autodiscovery for API Manager.
· Redeploy the Mule application to CloudHub.
· Test that the implementation URL is now enforcing API policies set in API Manager.
Scenario
The Accounts API has been implemented and deployed to CloudHub. Central IT has notified you that they need more vCores allocated to another project and you must shut down the API proxy that you just deployed in exercise 5-1.
In order to continue to enforce the current API policies, you now need to configure your implementation to enforce the API policy set in API Manager. This is referred to as configuring a basic endpoint as a managed API instance and can be achieved through enabling the Mule application (the API implementation) to use autodiscovery.
Note: To complete this exercise, you must have completed exercise 5-1.
Enable autodiscovery for the Mule application
Use your solution from exercise 5-1. In Anypoint Studio, configure your Mule application to include autodiscovery. Refer to the autodiscovery configuration documentation here: https://docs.mulesoft.com/api-manager/v/2.x/api-auto-discovery-new-concept.
Modify the RAML spec in your Mule application to support SLA policies.
Redeploy the Mule application
Redeploy the Mule application and ensure that the Anypoint Organization client_id and client_secret are passed to the Mule application.
Reconfigure the API in API Manager
Return to the API in API Manager and change the Managing type to Basic Endpoint.
Test the API implementation
Verify that the endpoints are now managed by the implementation by using a web client to make multiple requests to the implementation URL until the SLA limit is exceeded.
Note: Remember to also send values for the type query parameter and the Requester-ID header with the requests.
Verify your solution
Load the solution /files/module05/accounts-mod05-deploy-autodiscovery-solution.jar (in the MUFundamentals4.x DIY Files zip that you can download from the Course Resources)
and compare your solution.