Skip to content

Commit 12f7cd9

Browse files
committed
Up version
1 parent 5add51b commit 12f7cd9

27 files changed

Lines changed: 186 additions & 64 deletions

File tree

.ci/deploy.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
#!/usr/bin/env bash
22

3-
mvn -pl '!spring-cloud-zuul-ratelimit-coverage' clean deploy -Pdeploy-parent -fn
3+
#mvn -pl '!spring-cloud-zuul-ratelimit-coverage' clean deploy -Pdeploy-parent -fn
4+
5+
6+
7+
#mvn deploy:deploy-file \
8+
#-DgroupId=com.marcosbarbero.cloud \
9+
#-DartifactId=spring-cloud-zuul-ratelimit-parent \
10+
#-Dversion=1.5.0.RELEASE -DgeneratePom=false \
11+
#-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
12+
#-Dpackaging=pom \
13+
#-DrepositoryId=ossrh \
14+
#-Dfile=target/spring-cloud-zuul-ratelimit-parent-1.5.0.RELEASE.pom
15+
16+
# mvn clean deploy -Pdeploy-parent -N
17+

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Spring Cloud Zuul RateLimit [![Build Status](https://travis-ci.org/marcosbarbero
33
---
44

55
Module to enable rate limit per service in Netflix Zuul.
6-
There are five built-in rate limit approaches:
6+
There are four built-in rate limit approaches:
77
- Authenticated User
88
- Uses the authenticated username or 'anonymous'
99
- Request Origin
1010
- Uses the user origin request
1111
- URL
12-
- Uses the request path of the upstream service
12+
- Uses the request path of the downstream service
1313
- Global configuration per service:
1414
- This one does not validate the request Origin, Authenticated User or URI
1515
- To use this approach just don't set param 'type'
@@ -26,7 +26,7 @@ Add the dependency on pom.xml
2626
<dependency>
2727
<groupId>com.marcosbarbero.cloud</groupId>
2828
<artifactId>spring-cloud-zuul-ratelimit</artifactId>
29-
<version>1.4.0.RELEASE</version>
29+
<version>1.5.0.RELEASE</version>
3030
</dependency>
3131
```
3232

@@ -122,10 +122,10 @@ Property namespace: __zuul.ratelimit__
122122
|behind-proxy |true/false |false|
123123
|key-prefix |String |${spring.application.name:rate-limit-application}|
124124
|repository |CONSUL, REDIS, JPA, IN_MEMORY|IN_MEMORY|
125-
|default-policy|[Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L68)| - |
126-
|policies |Map of [Policy](.spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L68)| - |
127-
|default-policy-list|List of [Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L68)| - |
128-
|policy-list |Map of Lists of [Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L68)| - |
125+
|default-policy|[Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L86)| - |
126+
|policies |Map of [Policy](.spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L86)| - |
127+
|default-policy-list|List of [Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L86)| - |
128+
|policy-list |Map of Lists of [Policy](./spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java#L86)| - |
129129

130130
Policy properties:
131131

pom.xml

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>1.5.8.RELEASE</version>
9+
<version>1.5.9.RELEASE</version>
1010
</parent>
1111

1212
<groupId>com.marcosbarbero.cloud</groupId>
@@ -19,7 +19,7 @@
1919
]]>
2020
</description>
2121
<url>https://github.com/marcosbarbero/spring-cloud-zuul-ratelimit</url>
22-
<version>1.4.0.RELEASE</version>
22+
<version>1.5.0.RELEASE</version>
2323

2424
<licenses>
2525
<license>
@@ -34,7 +34,7 @@
3434
<maven.compiler.source>1.8</maven.compiler.source>
3535
<java.version>1.8</java.version>
3636
<nexus-staging-maven-plugin.version>1.6.3</nexus-staging-maven-plugin.version>
37-
<global.version>1.4.0.RELEASE</global.version>
37+
<global.version>1.5.0.RELEASE</global.version>
3838
<jacoco.version>0.8.0</jacoco.version>
3939
<jacoco.it.execution.data.file>
4040
${project.build.directory}/coverage-reports/jacoco.exec
@@ -52,6 +52,14 @@
5252
<name>Marcos Barbero</name>
5353
<timezone>CET</timezone>
5454
</developer>
55+
56+
<developer>
57+
<id>lchayoun</id>
58+
<email>lchayoun@gmail.com</email>
59+
<name>Liel Chayoun</name>
60+
<timezone>CET</timezone>
61+
</developer>
62+
5563
</developers>
5664

5765
<scm>
@@ -68,7 +76,7 @@
6876
<dependency>
6977
<groupId>org.springframework.cloud</groupId>
7078
<artifactId>spring-cloud-dependencies</artifactId>
71-
<version>Dalston.SR4</version>
79+
<version>Edgware.SR1</version>
7280
<type>pom</type>
7381
<scope>import</scope>
7482
</dependency>
@@ -130,34 +138,6 @@
130138
</configuration>
131139
</plugin>
132140

133-
<!--<plugin>-->
134-
<!--<groupId>org.jacoco</groupId>-->
135-
<!--<artifactId>jacoco-maven-plugin</artifactId>-->
136-
<!--<version>${jacoco.version}</version>-->
137-
<!--<executions>-->
138-
<!--<execution>-->
139-
<!--<id>agent-for-ut</id>-->
140-
<!--<goals>-->
141-
<!--<goal>prepare-agent</goal>-->
142-
<!--</goals>-->
143-
<!--<configuration>-->
144-
<!--<append>true</append>-->
145-
<!--<destFile>${jacoco.ut.execution.data.file}</destFile>-->
146-
<!--</configuration>-->
147-
<!--</execution>-->
148-
<!--<execution>-->
149-
<!--<id>agent-for-it</id>-->
150-
<!--<goals>-->
151-
<!--<goal>prepare-agent-integration</goal>-->
152-
<!--</goals>-->
153-
<!--<configuration>-->
154-
<!--<append>true</append>-->
155-
<!--<destFile>${jacoco.it.execution.data.file}</destFile>-->
156-
<!--</configuration>-->
157-
<!--</execution>-->
158-
<!--</executions>-->
159-
<!--</plugin>-->
160-
161141
<plugin>
162142
<groupId>org.jacoco</groupId>
163143
<artifactId>jacoco-maven-plugin</artifactId>

spring-cloud-starter-zuul-ratelimit/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-zuul-ratelimit-parent</artifactId>
77
<groupId>com.marcosbarbero.cloud</groupId>
8-
<version>1.4.0.RELEASE</version>
8+
<version>1.5.0.RELEASE</version>
99
<relativePath>..</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

spring-cloud-zuul-ratelimit-core/pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.marcosbarbero.cloud</groupId>
88
<artifactId>spring-cloud-zuul-ratelimit-parent</artifactId>
9-
<version>1.4.0.RELEASE</version>
9+
<version>1.5.0.RELEASE</version>
1010
<relativePath>..</relativePath>
1111
</parent>
1212

@@ -65,4 +65,69 @@
6565

6666
</dependencies>
6767

68+
69+
<profiles>
70+
<profile>
71+
<id>deploy</id>
72+
<build>
73+
<plugins>
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-gpg-plugin</artifactId>
77+
<executions>
78+
<execution>
79+
<id>sign-artifacts</id>
80+
<phase>verify</phase>
81+
<goals>
82+
<goal>sign</goal>
83+
</goals>
84+
</execution>
85+
</executions>
86+
</plugin>
87+
88+
<plugin>
89+
<groupId>org.sonatype.plugins</groupId>
90+
<artifactId>nexus-staging-maven-plugin</artifactId>
91+
<version>${nexus-staging-maven-plugin.version}</version>
92+
<extensions>true</extensions>
93+
<configuration>
94+
<serverId>ossrh</serverId>
95+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
96+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
97+
</configuration>
98+
</plugin>
99+
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-source-plugin</artifactId>
103+
<executions>
104+
<execution>
105+
<id>attach-sources</id>
106+
<goals>
107+
<goal>jar</goal>
108+
</goals>
109+
</execution>
110+
</executions>
111+
</plugin>
112+
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-javadoc-plugin</artifactId>
116+
<executions>
117+
<execution>
118+
<id>attach-javadocs</id>
119+
<goals>
120+
<goal>jar</goal>
121+
</goals>
122+
</execution>
123+
</executions>
124+
<configuration>
125+
<additionalparam>-Xdoclint:none</additionalparam>
126+
</configuration>
127+
</plugin>
128+
</plugins>
129+
</build>
130+
</profile>
131+
</profiles>
132+
68133
</project>

spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/RateLimitAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/DefaultRateLimitKeyGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/Rate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/RateLimiter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/config/properties/RateLimitProperties.java

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,7 +56,25 @@ public class RateLimitProperties {
5656
private Repository repository = Repository.IN_MEMORY;
5757

5858
public enum Repository {
59-
REDIS, CONSUL, JPA, IN_MEMORY
59+
/**
60+
* Uses Redis as data storage
61+
*/
62+
REDIS,
63+
64+
/**
65+
* Uses Consul as data storage
66+
*/
67+
CONSUL,
68+
69+
/**
70+
* Uses SQL database as data storage
71+
*/
72+
JPA,
73+
74+
/**
75+
* Uses a ConcurrentHashMap as data storage
76+
*/
77+
IN_MEMORY
6078
}
6179

6280
public List<Policy> getPolicies(String key) {
@@ -78,7 +96,20 @@ public static class Policy {
7896
private List<Type> type = Lists.newArrayList();
7997

8098
public enum Type {
81-
ORIGIN, USER, URL
99+
/**
100+
* Rate limit policy considering the user's origin.
101+
*/
102+
ORIGIN,
103+
104+
/**
105+
* Rate limit policy considering the authenticated user.
106+
*/
107+
USER,
108+
109+
/**
110+
* Rate limit policy considering the request path to the downstream service.
111+
*/
112+
URL
82113
}
83114
}
84115
}

0 commit comments

Comments
 (0)