Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from Axway-API-Management-Plus/spring-boot-2
Browse files Browse the repository at this point in the history
Spring boot 2
  • Loading branch information
rathnapandi authored May 27, 2020
2 parents 714dbc4 + c3cd346 commit 7090c7a
Show file tree
Hide file tree
Showing 61 changed files with 994 additions and 34,512 deletions.
57 changes: 36 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
- Axway Service Broker for Pivotal Cloud Foundry based on [Fully brokered Architecture](https://docs.pivotal.io/pivotalcf/1-12/services/route-services.html#fully-brokered)


## API Management Version Compatibilty
This artefact was successfully tested for the following versions:
- Axway AMPLIFY API Management 7.6.2 SP3 and 7.7
## API Management Version Compatibility
This artifact successfully tested with following versions:
- Axway AMPLIFY API Management 7.6.2 SP3 and v7.7.20200330
- cf 2.8.1


## Prerequisites
Expand Down Expand Up @@ -33,7 +34,18 @@ This artefact was successfully tested for the following versions:
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 }
}
}
}

}
```

Expand All @@ -46,12 +58,12 @@ This artefact was successfully tested for the following versions:
```
Build the project (output from `cf push` command provides fully qualified URL as output)
```bash
$mvn clean install
$mvn clean package
```

or you can use the following command if you want to skip testing step:
```bash
$mvn clean install -Dmaven.test.skip=true
$mvn clean package -Dmaven.test.skip=true
```
Now, you can push your app to PCF:
```bash
Expand Down Expand Up @@ -111,10 +123,9 @@ This artefact was successfully tested for the following versions:

$cf set-env axway-apim-service-broker cf_admin_username [email protected]
$cf set-env axway-apim-service-broker cf_admin_password changme
$cf set-env axway-apim-service-broker login_host https://login.sys.pie-25.cfplatformeng.com/oauth/token
$cf set-env axway-apim-service-broker cc_host https://api.sys.pie-25.cfplatformeng.com
$cf set-env axway-apim-service-broker api_host uaa.sys.industry.cf-app.com

$cf set-env axway-apim-service-broker TRUST_CERTS login.sys.pie-25.cfplatformeng.com,api.sys.pie-25.cfplatformeng.com //If your PCF instance uses self-signed certs, you may need to use this environment variable to prevent some security errors
$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
Expand Down Expand Up @@ -165,10 +176,10 @@ $cf push

```json
{
"apiname": "pcftest",
"type":": "swagger",
"uri": "/v2/api-docs"
}
"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.
Expand All @@ -185,34 +196,38 @@ $cf push

- Test the Pivotal Application

Try to access your apps 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:
- One that comes from GoRouter (PCF)
- The second one comes as a riderect from API Gateway itself
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:
- One comes from GoRouter (PCF) to API Gateway
- The second one comes as a redirect from API Gateway itself

- Un-bind Application from Axway Service broker



## Axway Service Broker uninstallation

- Unbind Route - Un-bind Application from Axway Service broker

```bash
$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:
1. If API is in Published state, it will throw an error.
2. If API is in un-published state, delete frontend, backend API.

2. If API is in un-published state, delete front end API, backend API.

## Axway Service Broker uninstallation

- Delete Service
```bash
$cf delete-service AxwayAPIM
```

The delete service command does the following:
Cloud Foundry delete service command does the following:
1. If the service has binded application or routes, it throws an error.
2. Delete Frontend and Backend APIs
3. Delete applications
4. Delete User
5. Delete Organization

- Delete Service Broker
```bash
$cf delete-service-broker axway-apim-service-broker
```
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ applications:
- name: axway-apim-service-broker
memory: 1G
random-route: true
path: target/apim-service-broker-1.1.8.jar
path: target/apim-service-broker-1.2.0.jar

2 changes: 1 addition & 1 deletion param.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apiname": "pcftest",
"type":"swagger",
"uri": "http://greeting-app-talkative-squirrel.apps.tokyo.cf-app.com/api/v3/swagger.json"
"uri": "http://greeting-app-grumpy-llama-dx.apps.industry.cf-app.com/v3/swagger.json"
}
36 changes: 24 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,48 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.axway.apim</groupId>
<artifactId>apim-service-broker</artifactId>
<version>1.1.8</version>
<version>1.2.0</version>
<packaging>jar</packaging>
<name>axway-apim-service-broker</name>
<description>Axway APIM Service Broker</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.19.RELEASE</version>
<version>2.3.0.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<service-broker.version>1.0.2.RELEASE</service-broker.version>
<service-broker.version>1.0.3.RELEASE</service-broker.version>
<commons-io.version>2.5</commons-io.version>
<springframework.cloud>1.2.6.RELEASE</springframework.cloud>
<springframework.cloud>2.2.2.RELEASE</springframework.cloud>
<cloudfoundry.certificate.truster>1.0.1.RELEASE</cloudfoundry.certificate.truster>
<commons.validator>1.6</commons.validator>
<cloudfoundry-client.version>4.6.0.RELEASE</cloudfoundry-client.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-service-broker</artifactId>
<version>${service-broker.version}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-cloudfoundry-service-broker</artifactId>-->
<!-- <version>${service-broker.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-client-reactor</artifactId>
<version>${cloudfoundry-client.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -57,10 +69,10 @@
</dependency>
<!-- <dependency><groupId>org.cloudfoundry</groupId><artifactId>cloudfoundry-client</artifactId><version>2.13.0.RELEASE</version></dependency><dependency><groupId>org.cloudfoundry</groupId><artifactId>cloudfoundry-util</artifactId><version>2.13.0.RELEASE</version></dependency> -->
<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.security.oauth</groupId>-->
<!-- <artifactId>spring-security-oauth2</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>cloudfoundry-certificate-truster</artifactId>
Expand Down
30 changes: 16 additions & 14 deletions src/main/java/com/axway/apim/servicebroker/config/AxwayConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;

import com.axway.apim.servicebroker.service.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import com.axway.apim.servicebroker.exception.AxwayAPIGatewayErrorHandler;
import com.axway.apim.servicebroker.service.AxwayAPIClient;
import com.axway.apim.servicebroker.service.AxwayApplicationClient;
import com.axway.apim.servicebroker.service.AxwayOrganzationClient;
import com.axway.apim.servicebroker.service.AxwayUserClient;
import com.axway.apim.servicebroker.util.Util;
import com.fasterxml.jackson.databind.ObjectMapper;

//import com.axway.apim.servicebroker.exception.AxwayAPIGatewayErrorHandler;
import java.time.Duration;


@Configuration
public class AxwayConfig {
Expand Down Expand Up @@ -52,19 +49,19 @@ public boolean verify(String hostname, SSLSession session) {
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
//RestTemplate restClient = new RestTemplate();
RestTemplate restClient = restTemplateBuilder
.setConnectTimeout(connectTimeout)
.setReadTimeout(readTimeout)
.basicAuthorization(username, new String(password))
.setConnectTimeout(Duration.ofMillis(connectTimeout))
.setReadTimeout(Duration.ofMillis(readTimeout))
.basicAuthentication(username, new String(password))
.detectRequestFactory(false)
.build();
restClient.setErrorHandler(new AxwayAPIGatewayErrorHandler());
return restClient;
}

@Bean
public BrokerApiVersion brokerApiVersion() {
return new BrokerApiVersion();
}
// @Bean
// public BrokerApiVersion brokerApiVersion() {
// return new BrokerApiVersion();
// }

@Bean
public ObjectMapper objectMapper() {
Expand All @@ -90,6 +87,11 @@ public AxwayApplicationClient axwayApplicationClient() {
return axwayApplicationClient;
}

@Bean
public ServiceBrokerHelper serviceBrokerHelper(){
return new ServiceBrokerHelper();
}

@Bean
public AxwayAPIClient axwayAPIClient() {
AxwayAPIClient axwayAPIClient = new AxwayAPIClient();
Expand All @@ -102,7 +104,7 @@ public Util util() {
}

@Bean
public String url() {
public String apiManagerURL() {
return url;
}
}

This file was deleted.

Loading

0 comments on commit 7090c7a

Please sign in to comment.