@@ -37,7 +37,10 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
37
37
request .setRegionId (locationConfig .getRegionId ());
38
38
request .setLocationProduct (serviceCode );
39
39
request .setSecurityToken (credential .getSecurityToken ());
40
- request .setEndpointType (DEFAULT_ENDPOINT_TYPE );
40
+ if (isEmpty (endpointType )) {
41
+ endpointType = DEFAULT_ENDPOINT_TYPE ;
42
+ }
43
+ request .setEndpointType (endpointType );
41
44
42
45
ISigner signer = ShaHmac1Singleton .INSTANCE .getInstance ();
43
46
ProductDomain domain = new ProductDomain (locationConfig .getProduct (), locationConfig .getEndpoint ());
@@ -47,7 +50,7 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
47
50
HttpResponse httpResponse = HttpResponse .getResponse (httpRequest );
48
51
if (httpResponse .isSuccess ()) {
49
52
String data = new String (httpResponse .getContent (), "utf-8" );
50
- DescribeEndpointResponse response = getEndpointResponse (data );
53
+ DescribeEndpointResponse response = getEndpointResponse (data , endpointType );
51
54
if (response == null || isEmpty (response .getEndpoint ())) {
52
55
return null ;
53
56
}
@@ -68,16 +71,16 @@ public DescribeEndpointResponse describeEndpoint(String regionId, String service
68
71
}
69
72
}
70
73
71
- private DescribeEndpointResponse getEndpointResponse (String data ) throws ClientException {
74
+ private DescribeEndpointResponse getEndpointResponse (String data , String endpointType ) throws ClientException {
72
75
Reader reader = ReaderFactory .createInstance (FormatType .JSON );
73
76
UnmarshallerContext context = new UnmarshallerContext ();
74
77
75
78
context .setResponseMap (reader .read (data , "DescribeEndpointsResponse" ));
76
79
77
80
int endpointsLength = context .lengthValue ("DescribeEndpointsResponse.Endpoints.Length" );
78
81
for (int i = 0 ; i < endpointsLength ; i ++) {
79
- if (DEFAULT_ENDPOINT_TYPE .equalsIgnoreCase (context . stringValue ( "DescribeEndpointsResponse.Endpoints[" + i
80
- + "].Type" ))) {
82
+ if (endpointType .equalsIgnoreCase (context
83
+ . stringValue ( "DescribeEndpointsResponse.Endpoints[" + i + "].Type" ))) {
81
84
DescribeEndpointResponse response = new DescribeEndpointResponse ();
82
85
83
86
response .setRequestId (context .stringValue ("DescribeEndpointsResponse.RequestId" ));
0 commit comments