Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fb22047
remaking example to be a multi-project example
Oct 11, 2018
deccf83
update gradle wrapper
kazvictor Nov 1, 2018
b463bb2
Merge pull request #6 from ca-api-gateway-examples/multi-project-example
kazvictor Nov 1, 2018
ba4a396
updating to plugin version 0.6.32
kazvictor Nov 9, 2018
26748a7
updating config files do to plugin updates
kazvictor Nov 9, 2018
e2c8723
Merge pull request #7 from ca-api-gateway-examples/plugin-version-0.6.32
kazvictor Nov 9, 2018
62ee989
Enforcing line separators (#8)
Nov 19, 2018
9830f2f
139 - Removing folderpath from different build graldes. (#9)
amoghsa Dec 3, 2018
4ab15b9
Fixing encass property (#11)
Jan 16, 2019
ad31a5f
Sample usage for appliance gateways (#10)
Jan 25, 2019
1cb5112
Using import task from import plugin (#12)
Feb 5, 2019
5f28b4f
Upgrading to latest plugin and gradle version
Jun 10, 2019
cab1571
Standardizing environment values as Yaml format
Jun 10, 2019
e3382c4
Increasing examples and upgrading the repo
Jun 10, 2019
e5dc1f0
fix readme
Jun 10, 2019
d281e00
adding zip bundles task
Jun 12, 2020
50e1e11
Updated deployment build.gralde as per the latest dev plugin artifacts
Jun 19, 2020
c0facc6
Merge pull request #18 from CAAPIM/bugfix/fixGradleBuildFile
uppoju Jun 21, 2020
6e78ff8
Added example encass annotation project
Jun 25, 2020
9fa4932
Addressed review comments
Jun 26, 2020
e53c170
Merge pull request #19 from CAAPIM/feature/encassAnnotationExample
uppoju Jun 29, 2020
d3de649
Zip task is modified to generate artifact for environment bundle
Jul 28, 2020
cbec108
Updated import bundle configuration
Jul 28, 2020
b69354a
Updated bundle-hints annotation for name
Jul 28, 2020
e033945
Merge pull request #20 from CAAPIM/feature/zipTask
uppoju Jul 28, 2020
8b2794a
Added examples for each environment type
Aug 18, 2020
0086701
Modified folder, policy and service names
Aug 18, 2020
567f998
Removed privateKey attribute from yml file
Aug 19, 2020
a10400d
Merge pull request #21 from CAAPIM/NORALLY/NORALLY_entityExamples
uppoju Aug 19, 2020
038316e
Updated private key
Aug 19, 2020
ce01ed1
updated private key configuration
Sep 16, 2020
1d2739c
Merge pull request #22 from CAAPIM/NORALLY/NORALLY_privatekey
uppoju Sep 16, 2020
c469e32
Renamed gateway developer plugin to gateway-policy-plugin
Sep 24, 2020
298519b
Merge pull request #24 from CAAPIM/feature/renamePlugin
uppoju Sep 25, 2020
fa689c5
Updated plugin version
Sep 28, 2020
9e7be8e
Merge pull request #25 from CAAPIM/feature/update_version
uppoju Sep 28, 2020
389bd14
Removed gw7 reference
Sep 29, 2020
f33a9de
Updated docker compose with bundles
Sep 29, 2020
a45d09f
Added entity bundles in docker compose file
Sep 29, 2020
c2f4ba6
Merge pull request #26 from CAAPIM/feature/docker_deployment
uppoju Sep 29, 2020
9ab377e
Update README.md
malathibondili Oct 1, 2020
a2cac51
Update README.md
malathibondili Oct 1, 2020
a39a5e1
Update README.md
scottchc1 Feb 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.txt text
*.java text
*.groovy text
*.js text
*.form text
*.c text
*.h text
*.cpp text
*.xml text
*.xsd text
*.config text
*.conf text
*.properties text
*.manifest text
*.yml text
*.json text

# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
*.pl text eol=lf
*.sql text eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.cmd text eol=crlf
*.sln text eol=crlf
*.rc text eol=crlf
*.vcproj text eol=crlf
modules/gateway/server/src/test/resources/com/l7tech/server/policy/resources/REQUEST_signed_attachment.txt text eol=crlf
modules/gateway/server/src/test/resources/com/l7tech/server/policy/resources/REQUEST_unsigned_attachment.txt text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.jar binary
*.tgz binary
*.ico binary
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# of the MIT license. See the LICENSE file for details.

# Root files to ignore
/.gradle/
.gradle/
/.idea/
/*.iml
/build/
build/
/out/
.DS_Store
.java-version
Expand Down
56 changes: 1 addition & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1 @@
[![Waffle.io - Columns and their card count](https://badge.waffle.io/ca-api-Gateway/Gateway-developer-plugin.svg?columns=all)](https://waffle.io/ca-api-Gateway/Gateway-developer-plugin)
[![Build Status](https://travis-ci.com/ca-api-gateway-examples/gateway-developer-example.svg?branch=master)](https://travis-ci.com/ca-api-gateway-examples/gateway-developer-example)

# About
This is an example repository that demonstrates how to use the [CA API Gateway Developer Plugin][gateway-developer-plugin].

# Getting Started

## Building the Solution
In order to package the solution into something that can be applied to the CA API Gateway run the following Gradle command:

```gradle build```

This takes the solution that is contained in the `src/main/gateway` folder and packages it into a bundle at `build/gateway/gateway-developer-example.bundle`

## Running the Solution
In order to run the solution you need to do the following:

1) Put a valid gateway license in the `docker` folder. The license file should be called `license.xml`
2) Make sure you have already built the solution by running `gradle build`
3) Start the Gateway Container by running: `docker-compose up`

After the container is up and running you can connect the CA API Gateway Policy Manager to it and/or call the example API at `/example`

## Exporting Updates
If you connect to the running gateway with the CA API Gateway Policy Manager and make changes to the services you can export those changes by running:

```gradle export```

This will export the changes to the `src/main/gateway` folder. Note that your local edits will be overridden by changes from the gateway

# About the Example Solution
The solution that is checked into this repository is contains a single folder and service. The service exposes `/example` and will respond with the following JSON for any HTTP(S) request:
```json
{
"you-say": ["Hello", "Gateway"],
"gateway-says": ["Hello", "User"]
}
```

# Giving Back
## How You Can Contribute
Contributions are welcome and much appreciated. To learn more, see the [Contribution Guidelines][contributing].

## License

Copyright (c) 2018 CA. All rights reserved.

This software may be modified and distributed under the terms
of the MIT license. See the [LICENSE][license-link] file for details.


[license-link]: /LICENSE
[contributing]: /CONTRIBUTING.md
[gateway-developer-plugin]: https://github.com/ca-api-gateway/gateway-developer-plugin
Repo has been moved. Please go to https://github.com/Layer7-Community/Utilities/tree/main/policy-plugin-examples
9 changes: 9 additions & 0 deletions audit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2018 CA. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

GatewayExportConfig {
folderPath = '/audit-policies'
}
7 changes: 7 additions & 0 deletions audit/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2018 CA. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

rootProject.name = 'audit'
12 changes: 12 additions & 0 deletions audit/src/main/gateway/config/audit-policies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Audit Viewer Policy:
path: "audit-policies/Audit Viewer Policy"
tag: "audit-viewer"
Audit Filter Policy:
path: "audit-policies/Audit Filter Policy"
tag: "audit-message-filter"
'[Internal Audit Sink Policy]':
path: "audit-policies/[Internal Audit Sink Policy]"
tag: "audit-sink"
'[Internal Audit Lookup Policy]':
path: "audit-policies/[Internal Audit Lookup Policy]"
tag: "audit-lookup"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:L7p="http://www.layer7tech.com/ws/policy">
<wsp:All wsp:Usage="Required">
<L7p:EncodeDecode>
<L7p:SourceVariableName stringValue="request.mainpart"/>
<L7p:TargetContentType stringValue="text/xml; charset=utf-8"/>
<L7p:TargetDataType variableDataType="message"/>
<L7p:TargetVariableName stringValue="request"/>
<L7p:TransformType transformType="BASE64_ENCODE"/>
</L7p:EncodeDecode>
<L7p:SetVariable>
<L7p:Expression><![CDATA[&lt;savedmessage xmlns=&quot;http://layer7tech.com/ns/audit&quot;&gt;
${request.mainpart}
&lt;/savedmessage&gt;]]></L7p:Expression>
<L7p:ContentType stringValue="text/xml; charset=utf-8"/>
<L7p:DataType variableDataType="message"/>
<L7p:VariableToSet stringValue="request"/>
</L7p:SetVariable>
<L7p:CommentAssertion>
<L7p:Comment stringValue="Configure cert to use here. Should match the Audit Viewer Private Key if defined."/>
</L7p:CommentAssertion>
<L7p:NonSoapEncryptElement>
<L7p:Target target="REQUEST"/>
<L7p:XpathExpression xpathExpressionValue="included">
<L7p:Expression stringValue="/*"/>
<L7p:Namespaces mapValue="included">
<L7p:entry>
<L7p:key stringValue="xenc"/>
<L7p:value stringValue="http://www.w3.org/2001/04/xmlenc#"/>
</L7p:entry>
<L7p:entry>
<L7p:key stringValue="ds"/>
<L7p:value stringValue="http://www.w3.org/2000/09/xmldsig#"/>
</L7p:entry>
</L7p:Namespaces>
</L7p:XpathExpression>
</L7p:NonSoapEncryptElement>
</wsp:All>
</wsp:Policy>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:L7p="http://www.layer7tech.com/ws/policy">
<wsp:All wsp:Usage="Required">
<L7p:NonSoapDecryptElement/>
<L7p:RequestXpathAssertion>
<L7p:VariablePrefix stringValue="output"/>
<L7p:XpathExpression xpathExpressionValue="included">
<L7p:Expression stringValue="/ns:savedmessage"/>
<L7p:Namespaces mapValue="included">
<L7p:entry>
<L7p:key stringValue="ns"/>
<L7p:value stringValue="http://layer7tech.com/ns/audit"/>
</L7p:entry>
<L7p:entry>
<L7p:key stringValue="s"/>
<L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
</L7p:entry>
</L7p:Namespaces>
</L7p:XpathExpression>
</L7p:RequestXpathAssertion>
<L7p:EncodeDecode>
<L7p:CharacterEncoding stringValueNull="null"/>
<L7p:SourceVariableName stringValue="output.result"/>
<L7p:TargetContentType stringValue="text/xml; charset=utf-8"/>
<L7p:TargetDataType variableDataType="message"/>
<L7p:TargetVariableName stringValue="request"/>
<L7p:TransformType transformType="BASE64_DECODE"/>
</L7p:EncodeDecode>
</wsp:All>
</wsp:Policy>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:L7p="http://www.layer7tech.com/ws/policy">
<wsp:All wsp:Usage="Required">
<L7p:AuditDetailAssertion>
<L7p:CustomLoggerSuffix stringValue="audit"/>
<L7p:Detail stringValue="looking up audits"/>
</L7p:AuditDetailAssertion>
</wsp:All>
</wsp:Policy>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:L7p="http://www.layer7tech.com/ws/policy">
<wsp:All wsp:Usage="Required">
<L7p:AuditRecordToXml/>
<L7p:AuditDetailAssertion>
<L7p:CustomLoggerSuffix stringValue="audit"/>
<L7p:Detail stringValue="${request.mainpart}"/>
<L7p:LoggingOnly booleanValue="true"/>
</L7p:AuditDetailAssertion>
</wsp:All>
</wsp:Policy>
65 changes: 51 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,63 @@
* of the MIT license. See the LICENSE file for details.
*/

plugins {
id "com.ca.apim.gateway.gateway-developer-plugin" version "0.5.00"
id "com.ca.apim.gateway.gateway-export-plugin" version "0.5.00"
buildscript {
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// "+" will always pull the latest available
classpath "com.ca.apim.gateway:gateway-policy-plugin:1.0.+"
classpath "com.ca.apim.gateway:gateway-export-plugin:1.0.+"
classpath "com.ca.apim.gateway:gateway-import-plugin:1.0.+"
}
}

group 'com.ca.apim.gateway'
version '0.5.00'
subprojects {
apply plugin: 'com.ca.apim.gateway.gateway-policy-plugin'
if (!project.name.equals('deployment')) {
apply plugin: 'com.ca.apim.gateway.gateway-export-plugin'
GatewayConnection {
url = 'https://localhost:8443/restman'
}
}

group 'com.ca.apim.gateway'
version = '1.0.0'

GatewayConnection {
url = 'https://localhost:8443/restman'
folderPath = '/gateway-solution'
repositories {
mavenLocal()
flatDir {
dirs new File(project.parent.rootDir, "lib")
}
jcenter()
}
}

repositories {
flatDir {
dirs "lib"
}
wrapper {
gradleVersion = '4.10'
}

dependencies {
bundle group: 'my-bundle', name: 'my-bundle', version: '1.0.00', ext: 'bundle'
// Zip task
FileTree tree = fileTree(dir: 'build/gateway/bundle', include: '*.metadata.yml')
tree.each { File file ->
String bundleName = file.name.substring(0, file.name.indexOf('.metadata.yml'))
task "zip-${bundleName}"(type: Zip) {
archiveName = bundleName + '.zip'
from('build/gateway/bundle') {
include bundleName + '*.bundle'
include file.name
}
}
}

// Zip bundles task
task zipBundles {
tree.each { File file ->
String bundleName = file.name.substring(0, file.name.indexOf('.metadata.yml'))
dependsOn 'zip-' + bundleName;
}
}
13 changes: 13 additions & 0 deletions business-integrations/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2018 CA. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

GatewayExportConfig {
folderPath = '/business-integrations'
}

dependencies {
bundle project(':common-services')
}
7 changes: 7 additions & 0 deletions business-integrations/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2018 CA. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

rootProject.name = 'business-integrations'
10 changes: 10 additions & 0 deletions business-integrations/src/main/gateway/config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
business-integrations/b2b-services:
url: "/b2b/*"
policy: "business-integrations/b2b-services"
httpMethods:
- "DELETE"
- "POST"
- "GET"
- "PUT"
properties: {}
wssProcessingEnabled: false
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:L7p="http://www.layer7tech.com/ws/policy">
<wsp:All wsp:Usage="Required">
<L7p:CommentAssertion>
<L7p:Comment stringValue="Policy Fragment: a-policy-backed-service"/>
<L7p:Comment stringValue="*************** Implement b2b service here ******************"/>
</L7p:CommentAssertion>
</wsp:All>
</wsp:Policy>
30 changes: 30 additions & 0 deletions cassandra-example/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.ca.apim.gateway:config-builder:1.0.+"
classpath "com.ca.apim.gateway:environment-creator-application:1.0.+"
classpath "com.ca.apim.gateway:gateway-policy-plugin:1.0.+"
classpath "com.ca.apim.gateway:gateway-export-plugin:1.0.+"
}
}

apply plugin: 'com.ca.apim.gateway.gateway-export-plugin'
apply plugin: 'com.ca.apim.gateway.gateway-policy-plugin'
group = "cassandraConnection"
version = '1.0.0'
repositories {
gradlePluginPortal()
mavenCentral()
jcenter()
}

EnvironmentConfig{
name="cassandraExample"
map=[
"CASSANDRA_CONNECTION": file("./src/main/gateway/config/cassandra-connections.yml")
]
}
7 changes: 7 additions & 0 deletions cassandra-example/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2018 CA. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

rootProject.name = 'cassandra-example'
Loading