forked from Ecwid/consul-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ecwid#186 token as request param is deprecated
- more places where token was still used as url parameter - throw Hard Runtime error is we still use token as url parameter
- Loading branch information
1 parent
dbcda19
commit a95fb09
Showing
13 changed files
with
73 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ | |
public interface UrlParameters { | ||
|
||
public List<String> toUrlParameters(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
package com.ecwid.consul.v1.acl; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.ecwid.consul.ConsulException; | ||
import com.ecwid.consul.SingleUrlParameters; | ||
import com.ecwid.consul.UrlParameters; | ||
import com.ecwid.consul.json.GsonFactory; | ||
import com.ecwid.consul.transport.HttpResponse; | ||
import com.ecwid.consul.transport.TLSConfig; | ||
|
@@ -17,6 +12,9 @@ | |
import com.ecwid.consul.v1.acl.model.UpdateAcl; | ||
import com.google.gson.reflect.TypeToken; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Vasily Vasilkov ([email protected]) | ||
*/ | ||
|
@@ -54,9 +52,8 @@ public AclConsulClient(String agentHost, int agentPort, TLSConfig tlsConfig) { | |
|
||
@Override | ||
public Response<String> aclCreate(NewAcl newAcl, String token) { | ||
UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null; | ||
String json = GsonFactory.getGson().toJson(newAcl); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/create", json, tokenParams); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/create", json,token); | ||
|
||
if (httpResponse.getStatusCode() == 200) { | ||
Map<String, String> value = GsonFactory.getGson().fromJson(httpResponse.getContent(), new TypeToken<Map<String, String>>() { | ||
|
@@ -69,9 +66,8 @@ public Response<String> aclCreate(NewAcl newAcl, String token) { | |
|
||
@Override | ||
public Response<Void> aclUpdate(UpdateAcl updateAcl, String token) { | ||
UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null; | ||
String json = GsonFactory.getGson().toJson(updateAcl); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/update", json, tokenParams); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/update", json, token); | ||
|
||
if (httpResponse.getStatusCode() == 200) { | ||
return new Response<Void>(null, httpResponse); | ||
|
@@ -82,8 +78,7 @@ public Response<Void> aclUpdate(UpdateAcl updateAcl, String token) { | |
|
||
@Override | ||
public Response<Void> aclDestroy(String aclId, String token) { | ||
UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null; | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/destroy/" + aclId, "", tokenParams); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/destroy/" + aclId, "", token); | ||
|
||
if (httpResponse.getStatusCode() == 200) { | ||
return new Response<Void>(null, httpResponse); | ||
|
@@ -114,8 +109,7 @@ public Response<Acl> getAcl(String id) { | |
|
||
@Override | ||
public Response<String> aclClone(String aclId, String token) { | ||
UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null; | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/clone/" + aclId, "", tokenParams); | ||
HttpResponse httpResponse = rawClient.makePutRequest("/v1/acl/clone/" + aclId, "", token); | ||
|
||
if (httpResponse.getStatusCode() == 200) { | ||
Map<String, String> value = GsonFactory.getGson().fromJson(httpResponse.getContent(), new TypeToken<Map<String, String>>() { | ||
|
@@ -128,8 +122,7 @@ public Response<String> aclClone(String aclId, String token) { | |
|
||
@Override | ||
public Response<List<Acl>> getAclList(String token) { | ||
UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null; | ||
HttpResponse httpResponse = rawClient.makeGetRequest("/v1/acl/list", tokenParams); | ||
HttpResponse httpResponse = rawClient.makeGetRequest("/v1/acl/list", token); | ||
|
||
if (httpResponse.getStatusCode() == 200) { | ||
List<Acl> value = GsonFactory.getGson().fromJson(httpResponse.getContent(), new TypeToken<List<Acl>>() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.