Skip to content

Commit c2ab3c9

Browse files
author
BitsAdmin
committed
Merge branch 'dev/lsx/endpoint' into 'integration_2025-04-28_881148411650'
feat: [development task] core endpoint (1191509) See merge request iaasng/volcengine-java-sdk!464
2 parents 7461e93 + b18c2b0 commit c2ab3c9

File tree

4 files changed

+592
-144
lines changed

4 files changed

+592
-144
lines changed

volcengine-java-sdk-core/src/main/java/com/volcengine/ApiClient.java

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,15 @@ public class ApiClient {
101101

102102
private Integer keepAliveDurationMs = 5 * 60 * 1000;
103103

104+
private Set<String> customBootstrapRegion;
105+
106+
private Boolean useDualStack;
104107

105108
/*
106109
* Constructor for ApiClient
107110
*/
108111
public ApiClient() {
109-
ConnectionPool connectionPool=new ConnectionPool(maxIdleConns,keepAliveDurationMs);
112+
ConnectionPool connectionPool = new ConnectionPool(maxIdleConns, keepAliveDurationMs);
110113
httpClient = new OkHttpClient();
111114
httpClient.setConnectionPool(connectionPool);
112115

@@ -147,6 +150,17 @@ private static String getUserAgent() {
147150
return String.format(format, Version.SDK_NAME, Version.SDK_VERSION, jdkInfo, osInfo, arch);
148151
}
149152

153+
/**
154+
* Set the User-Agent header's value (by adding to the default header map).
155+
*
156+
* @param userAgent HTTP request's user agent
157+
* @return ApiClient
158+
*/
159+
public ApiClient setUserAgent(String userAgent) {
160+
addDefaultHeader("User-Agent", userAgent);
161+
return this;
162+
}
163+
150164
/**
151165
* Get base path
152166
*
@@ -237,7 +251,6 @@ public ApiClient setCredentials(Credentials credentials) {
237251
return this;
238252
}
239253

240-
241254
/**
242255
* Get HTTP client
243256
*
@@ -388,18 +401,6 @@ public Authentication getAuthentication(String authName) {
388401
return authentications.get(authName);
389402
}
390403

391-
392-
/**
393-
* Set the User-Agent header's value (by adding to the default header map).
394-
*
395-
* @param userAgent HTTP request's user agent
396-
* @return ApiClient
397-
*/
398-
public ApiClient setUserAgent(String userAgent) {
399-
addDefaultHeader("User-Agent", userAgent);
400-
return this;
401-
}
402-
403404
/**
404405
* Add a default header.
405406
*
@@ -530,6 +531,46 @@ public ApiClient setWriteTimeout(int writeTimeout) {
530531
return this;
531532
}
532533

534+
/**
535+
* Get the custom bootstrapping regions.
536+
*
537+
* @return Set of custom bootstrapping regions
538+
*/
539+
public Set<String> getCustomBootstrapRegion() {
540+
return this.customBootstrapRegion;
541+
}
542+
543+
/**
544+
* Set the custom bootstrapping regions.
545+
*
546+
* @param customBootstrapRegion Set of custom bootstrapping regions
547+
* @return Api client
548+
*/
549+
public ApiClient setCustomBootstrapRegion(Set<String> customBootstrapRegion) {
550+
this.customBootstrapRegion = customBootstrapRegion;
551+
return this;
552+
}
553+
554+
/**
555+
* Get the use dual stack flag.
556+
*
557+
* @return use dual stack flag
558+
*/
559+
public Boolean getUseDualStack() {
560+
return this.useDualStack;
561+
}
562+
563+
/**
564+
* Set the use dual stack flag.
565+
*
566+
* @param useDualStack boolean
567+
* @return Api client
568+
*/
569+
public ApiClient setUseDualStack(boolean useDualStack) {
570+
this.useDualStack = useDualStack;
571+
return this;
572+
}
573+
533574
/**
534575
* Format the given parameter object into string.
535576
*
@@ -1656,7 +1697,7 @@ public Integer getMaxIdleConns() {
16561697

16571698
public ApiClient setMaxIdleConns(Integer maxIdleConns) {
16581699
this.maxIdleConns = maxIdleConns;
1659-
this.httpClient.setConnectionPool(new ConnectionPool(maxIdleConns,keepAliveDurationMs));
1700+
this.httpClient.setConnectionPool(new ConnectionPool(maxIdleConns, keepAliveDurationMs));
16601701
return this;
16611702
}
16621703

@@ -1666,7 +1707,7 @@ public Integer getKeepAliveDurationMs() {
16661707

16671708
public ApiClient setKeepAliveDurationMs(Integer keepAliveDurationMs) {
16681709
this.keepAliveDurationMs = keepAliveDurationMs;
1669-
this.httpClient.setConnectionPool(new ConnectionPool(maxIdleConns,keepAliveDurationMs));
1710+
this.httpClient.setConnectionPool(new ConnectionPool(maxIdleConns, keepAliveDurationMs));
16701711
return this;
16711712
}
16721713
}

0 commit comments

Comments
 (0)