This artifact successfully tested with following versions:
Add a custom property to organizations
Edit the following file:
INSTALL_DIR/apigateway/webapps/apiportal/vordel/apiportal/app/app.config
Insert the following code fragment marked in bold in the organizations property:
customPropertiesConfig: {
organization: {
service_instance_id:{
label: 'Service Instance Id'
}
},
api: {
cfBindingId:{
label: 'Cloud Foundry Binding Id',
permissions: {
admin: { read: true, write: true, visible:true },
oadmin: { read: true, write: false, visible:true },
user: { read: true, write: false, visible:true }
}
}
}
}
Publish Server broker Application
Check out the code from github
$git clone https://github.com/Axway-API-Management-Plus/Cloud-Foundry-Service-Broker-Sample.git
Build the project (output from cf push
command provides fully qualified URL as output)
$mvn clean package
or you can use the following command if you want to skip testing step:
$mvn clean package -Dmaven.test.skip=true
Now, you can push your app to PCF:
$cf push
Showing health and status for app axway-apim-service-broker in org axwaydev / space dev as admin...
OK
requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: axway-apim-service-broker-nocuous-ovoviviparousness.cfapps.pie-25.cfplatformeng.com
last uploaded: Wed Jan 3 21:35:47 UTC 2018
stack: cflinuxfs2
buildpack: client-certificate-mapper=1.2.0_RELEASE container-security-provider=1.8.0_RELEASE java-buildpack=v4.5-offline-https://github.com/cloudfoundry/java-buildpack.git#ffeefb9 java-main java-opts jvmkill-agent=1.10.0_RELEASE open-jdk-like-jre=1.8.0_1...
Create Service Broker
$cf create-service-broker axway-apim-service-broker admin changeme http://axway-apim-service-broker-nocuous-ovoviviparousness.cfapps.pie-25.cfplatformeng.com --space-scoped
Getting services from marketplace in org axwaydev / space dev as admin...
OK
Note: In the create-service-broker
command, use an app URL shown in the output from the cf push
command
Check whether the service broker is added in Pivotal market place
$cf marketplace
Getting services from marketplace in org axwaydev / space dev as admin...
OK
service plans description
Axway-APIM APIM Axway service broker implementation
app-autoscaler standard Scales bound applications in response to load
p-circuit-breaker-dashboard standard Circuit Breaker Dashboard for Spring Cloud Applications
p-config-server standard Config Server for Spring Cloud Applications
p-mysql 100mb MySQL databases on demand
p-rabbitmq standard RabbitMQ is a robust and scalable high-performance multi-protocol messaging broker.
p-redis shared-vm, dedicated-vm Redis service to provide pre-provisioned instances configured as a datastore, running on a shared or dedicated VM.
p-service-registry standard Service Registry for Spring Cloud Applications
p.rabbitmq solo RabbitMQ Service
p.redis cache-small Redis service to provide on-demand dedicated instances configured as a cache.
Add environment variables to Service Broker
$cf set-env axway-apim-service-broker axway_apimanager_url https://myAPIM.server.com:8075
$cf set-env axway-apim-service-broker axway_apimanager_username apiadmin
$cf set-env axway-apim-service-broker axway_apimanager_password changeme
$cf set-env axway-apim-service-broker axway_apimanager_traffic_url https://myAPIM.server.com:8065 // In High Availability scenario the URL will be a Load Balancer URL
$cf set-env axway-apim-service-broker cf_admin_username admin@axway.com
$cf set-env axway-apim-service-broker cf_admin_password changme
$cf set-env axway-apim-service-broker api_host uaa.sys.industry.cf-app.com
$cf set-env axway-apim-service-broker TRUST_CERTS uaa.sys.industry.cf-app.com //If your PCF instance uses self-signed certs, you may need to use this environment variable to prevent some security errors
Refresh Service Broker Instance to read the new environment variable
$cf restage axway-apim-service-broker
Create Cloud Foundry Service to Bind and Unbind Routes
$cf create-service Axway-APIM APIM-Free AxwayAPIM
Creating service instance AxwayAPIM in org axwaydev / space dev as admin...
OK
Create service command does the following
If any changes are made in the code base, publish the changes to Pivotal Elastic run time
$cf push
Upload the following project in Axway Policy Studio
Open Project
.Deploy this project to your instance of Axway API Gateway. You may also export the Forward Request to API Manger Traffic Port
policy from the project and import it in your API Gateway configuration. In addition, you will need to configure Gateway Listeners similar to how it is done in the provided project: port 8065 is mapped to the PCF
listener, port 7070 is mapped to the API Manager Traffic
listener.
Publish a target PCF application on Pivotal Cloud Foundry runtime
Add custom attribute in a json file (param.json)
{
"apiname": "pcftest",
"type": "swagger",
"uri": "/v2/api-docs"
}
apiName
is optional. If apiName
is not specified, Service broker fetch the API Name and from swagger or WSDL.
Possible values of type paramters are wsdl
and swagger
The URI value will be context name or Fully qualified Swagger / WSDL URL (http://greeting-app2-unwrinkleable-carriole.cfapps.pie-25.cfplatformeng.com/v2/api-docs). If context name is provided as input, the service broker reads the host name from Cloud Foundry Application.
Run Route binding command
$cf bind-route-service cfapps.pie-25.cfplatformeng.com AxwayAPIM --hostname greeting-app-tournois-postresurrection -c param.json
The route binding command invokes Axway Service broker. The Service broker creates Backend, Front-End API using Pass-Through as inbound security.
Test the Pivotal Application
Try to access your PCF application endpoint. To verify that the request goes through API Gateway, open Axway API Gateway Manager and look at the traffic tab. You should see two entries:
$cf unbind-route-service cfapps.pie-25.cfplatformeng.com AxwayAPIM --hostname greeting-app-tournois-postresurrection
The route unbinding command invokes Axway Service Broker and Service Broker does the following:
$cf delete-service AxwayAPIM
Cloud Foundry delete service command does the following:
$cf delete-service-broker axway-apim-service-broker
Please read Contributing.md for details on our code of conduct, and the process for submitting pull requests to us.
Axway Team