Skip to content

Commit 6e56923

Browse files
committed
Merge branch 'integration_2025-05-15_905315453698' into organization-Java-2022-01-01-online-1111-2025_04_17_11_29_38
2 parents aa0a394 + e419f5c commit 6e56923

File tree

980 files changed

+156370
-2268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

980 files changed

+156370
-2268
lines changed

README.md

Lines changed: 72 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,79 @@
11
# Volcengine SDK for Java
22

33
## Table of Contents
4+
45
* Requirements
56
* Usage
67
* API Dosc
78
* Note
89

910
### Requirements ###
10-
运行 SDK需要jdk **Java 1.7+**. 你可以下载最新的版本: http://developers.sun.com/downloads/.
11+
12+
运行 SDK需要jdk **Java 1.8.0_131+**. 你可以下载最新的版本: http://developers.sun.com/downloads/.
1113
如果 SDK版本 高于或者等于 **Java 9** 请依赖javax.annotation-api
1214
由于在高于或者等于 **Java 9** 中 javax.annotation-api 被移除
1315

1416
请在使用中引用
17+
1518
```xml
19+
1620
<dependency>
17-
<groupId>javax.annotation</groupId>
18-
<artifactId>javax.annotation-api</artifactId>
19-
<version>1.3.2</version>
21+
<groupId>javax.annotation</groupId>
22+
<artifactId>javax.annotation-api</artifactId>
23+
<version>1.3.2</version>
2024
</dependency>
2125
```
2226

2327
### Usage ###
28+
2429
* Getting Started
2530
* Example
2631

2732
#### Getting Started ####
2833

29-
##### 工程使用sdk #####
34+
##### 安装说明 #####
3035

3136
建议使用Maven构建自己的项目,添加需要的相应模块的依赖,示例如下:
3237

3338
##### Init maven setting.xml #####
39+
3440
如果您使用的版本大于0.1.27 可以不进行设置 直接使用中央仓库进行依赖
3541

3642
如果您使用的版本小于或者等于0.1.27
3743
需要使用字节跳动的maven仓库来完成依赖,请先到maven安装目录的conf/setting.xml
3844
在<mirrors/>标签中增加
3945

4046
```xml
47+
4148
<mirror>
42-
<id>bytedanceMaven</id>
43-
<mirrorOf>my-repo-id</mirrorOf>
44-
<name>字节跳动maven仓库</name>
45-
<url>https://artifact.bytedance.com/repository/releases/</url>
49+
<id>bytedanceMaven</id>
50+
<mirrorOf>my-repo-id</mirrorOf>
51+
<name>字节跳动maven仓库</name>
52+
<url>https://artifact.bytedance.com/repository/releases/</url>
4653
</mirror>
4754
```
4855

4956
##### Importing the pom #####
5057

5158
```xml
59+
5260
<dependencyManagement>
53-
<dependencies>
54-
<dependency>
55-
<groupId>com.volcengine</groupId>
56-
<artifactId>volcengine-java-sdk-bom</artifactId>
57-
<version>0.2.9</version>
58-
<type>pom</type>
59-
<scope>import</scope>
60-
</dependency>
61-
</dependencies>
61+
<dependencies>
62+
<dependency>
63+
<groupId>com.volcengine</groupId>
64+
<artifactId>volcengine-java-sdk-bom</artifactId>
65+
<version>0.2.9</version>
66+
<type>pom</type>
67+
<scope>import</scope>
68+
</dependency>
69+
</dependencies>
6270
</dependencyManagement>
6371
```
6472

65-
6673
##### Using the SDK Maven modules #####
6774

6875
```xml
76+
6977
<dependencies>
7078
<dependency>
7179
<groupId>com.volcengine</groupId>
@@ -83,6 +91,7 @@
8391
##### Credentials 配置 #####
8492

8593
**通过环境变量导入**:
94+
8695
```
8796
export VOLCENGINE_ACCESS_KEY=your ak
8897
export VOLCENGINE_SECRET_KEY=your sk
@@ -93,12 +102,34 @@ export VOLCENGINE_SESSION_TOKEN=token
93102
**代码方式引入**
94103

95104
```java
96-
Credentials credentials = Credentials.getCredentials(ak,sk);
105+
Credentials credentials = Credentials.getCredentials(ak, sk);
97106
//如果使用token
98-
Credentials credentials = Credentials.getCredentials(ak,sk,token);
107+
Credentials credentials = Credentials.getCredentials(ak, sk, token);
99108
```
100109

101-
#### Example ####
110+
##### Endpoint 设置 #####
111+
112+
如果您要自定义SDK的Endpoint,可以按照以下示例代码设置:
113+
114+
```java
115+
ApiClient apiClient = new ApiClient()
116+
.setCredentials(Credentials.getCredentials(ak, sk))
117+
.setRegion(region).setEndpoint("ecs.cn-beijing-autodriving.volcengineapi.com");
118+
```
119+
120+
火山引擎标准的Endpoint规则说明:
121+
122+
| Regional 服务 | Global 服务 |
123+
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
124+
| `{service}.{region}.volcengineapi.com` <br> 例如:云服务ecs在cn-beijing-autodriving Region域名为: `ecs.cn-beijing-autodriving.volcengineapi.com` | `{service}.volcengineapi.com` <br> 例如:访问控制iam为Global服务,域名为:`iam.volcengineapi.com` |
125+
126+
注:
127+
128+
- Service中存在_符号时,Endpoint时需转为-符号。存在大写字母时需转成小写。
129+
- 并非所有云产品和Region都支持标准域名,具体请前往您所使用的产品-API参考中查看。
130+
131+
#### SDK 示例 ####
132+
102133
```java
103134
import com.volcengine.ApiClient;
104135
import com.volcengine.ApiException;
@@ -111,26 +142,26 @@ import java.util.ArrayList;
111142
import java.util.List;
112143

113144
public class TestVpc {
114-
public static void main(String[] args)throws Exception {
115-
String ak = "your ak";
116-
String sk = "your sk";
117-
String region = "cn-beijing";
118-
119-
ApiClient apiClient = new ApiClient()
120-
.setCredentials(Credentials.getCredentials(ak,sk))
121-
.setRegion(region);
122-
VpcApi vpcApi = new VpcApi(apiClient);
123-
DescribeVpcsRequest request = new DescribeVpcsRequest();
124-
List<String> list = new ArrayList<>();
125-
list.add("vpc-13fpdgwk7rxfk3n6nu44wisg7");
126-
request.setVpcIds(list);
127-
try {
128-
DescribeVpcsResponse response = vpcApi.describeVpcs(request);
129-
System.out.println(response);
130-
} catch (ApiException e) {
131-
System.out.println(e.getResponseBody());
145+
public static void main(String[] args) throws Exception {
146+
String ak = "your ak";
147+
String sk = "your sk";
148+
String region = "cn-beijing";
149+
150+
ApiClient apiClient = new ApiClient()
151+
.setCredentials(Credentials.getCredentials(ak, sk))
152+
.setRegion(region);
153+
VpcApi vpcApi = new VpcApi(apiClient);
154+
DescribeVpcsRequest request = new DescribeVpcsRequest();
155+
List<String> list = new ArrayList<>();
156+
list.add("vpc-13fpdgwk7rxfk3n6nu44wisg7");
157+
request.setVpcIds(list);
158+
try {
159+
DescribeVpcsResponse response = vpcApi.describeVpcs(request);
160+
System.out.println(response);
161+
} catch (ApiException e) {
162+
System.out.println(e.getResponseBody());
163+
}
132164
}
133-
}
134165
}
135166

136167
```

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,9 @@
276276
<module>volcengine-java-sdk-volccontentplatform</module>
277277
<module>volcengine-java-sdk-edx</module>
278278
<module>volcengine-java-sdk-wafruntime</module>
279+
<module>volcengine-java-sdk-mlplatform20240701</module>
280+
<module>volcengine-java-sdk-vod20250101</module>
281+
<module>volcengine-java-sdk-tag</module>
282+
<module>volcengine-java-sdk-bmq20240901</module>
279283
</modules>
280284
</project>

volcengine-java-sdk-alb/src/main/java/com/volcengine/alb/AlbApi.java

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
import com.volcengine.alb.model.DescribeRulesResponse;
9696
import com.volcengine.alb.model.DescribeServerGroupAttributesRequest;
9797
import com.volcengine.alb.model.DescribeServerGroupAttributesResponse;
98+
import com.volcengine.alb.model.DescribeServerGroupBackendServersRequest;
99+
import com.volcengine.alb.model.DescribeServerGroupBackendServersResponse;
98100
import com.volcengine.alb.model.DescribeServerGroupsRequest;
99101
import com.volcengine.alb.model.DescribeServerGroupsResponse;
100102
import com.volcengine.alb.model.DescribeZonesRequest;
@@ -4395,6 +4397,130 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
43954397
apiClient.executeAsync(call, localVarReturnType, callback);
43964398
return call;
43974399
}
4400+
/**
4401+
* Build call for describeServerGroupBackendServers
4402+
* @param body (required)
4403+
* @param progressListener Progress listener
4404+
* @param progressRequestListener Progress request listener
4405+
* @return Call to execute
4406+
* @throws ApiException If fail to serialize the request body object
4407+
*/
4408+
public com.squareup.okhttp.Call describeServerGroupBackendServersCall(DescribeServerGroupBackendServersRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
4409+
Object localVarPostBody = body;
4410+
4411+
// create path and map variables
4412+
String localVarPath = "/DescribeServerGroupBackendServers/2020-04-01/alb/get/text_plain/";
4413+
4414+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
4415+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
4416+
4417+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
4418+
4419+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
4420+
4421+
final String[] localVarAccepts = {
4422+
"application/json"
4423+
};
4424+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
4425+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
4426+
4427+
final String[] localVarContentTypes = {
4428+
"text/plain"
4429+
};
4430+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
4431+
localVarHeaderParams.put("Content-Type", localVarContentType);
4432+
4433+
if(progressListener != null) {
4434+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
4435+
@Override
4436+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
4437+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
4438+
return originalResponse.newBuilder()
4439+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
4440+
.build();
4441+
}
4442+
});
4443+
}
4444+
4445+
String[] localVarAuthNames = new String[] { "volcengineSign" };
4446+
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
4447+
}
4448+
4449+
@SuppressWarnings("rawtypes")
4450+
private com.squareup.okhttp.Call describeServerGroupBackendServersValidateBeforeCall(DescribeServerGroupBackendServersRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
4451+
// verify the required parameter 'body' is set
4452+
if (body == null) {
4453+
throw new ApiException("Missing the required parameter 'body' when calling describeServerGroupBackendServers(Async)");
4454+
}
4455+
4456+
com.squareup.okhttp.Call call = describeServerGroupBackendServersCall(body, progressListener, progressRequestListener);
4457+
return call;
4458+
4459+
4460+
4461+
4462+
4463+
}
4464+
4465+
/**
4466+
*
4467+
*
4468+
* @param body (required)
4469+
* @return DescribeServerGroupBackendServersResponse
4470+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
4471+
*/
4472+
public DescribeServerGroupBackendServersResponse describeServerGroupBackendServers(DescribeServerGroupBackendServersRequest body) throws ApiException {
4473+
ApiResponse<DescribeServerGroupBackendServersResponse> resp = describeServerGroupBackendServersWithHttpInfo(body);
4474+
return resp.getData();
4475+
}
4476+
4477+
/**
4478+
*
4479+
*
4480+
* @param body (required)
4481+
* @return ApiResponse&lt;DescribeServerGroupBackendServersResponse&gt;
4482+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
4483+
*/
4484+
public ApiResponse<DescribeServerGroupBackendServersResponse> describeServerGroupBackendServersWithHttpInfo( @NotNull DescribeServerGroupBackendServersRequest body) throws ApiException {
4485+
com.squareup.okhttp.Call call = describeServerGroupBackendServersValidateBeforeCall(body, null, null);
4486+
Type localVarReturnType = new TypeToken<DescribeServerGroupBackendServersResponse>(){}.getType();
4487+
return apiClient.execute(call, localVarReturnType);
4488+
}
4489+
4490+
/**
4491+
* (asynchronously)
4492+
*
4493+
* @param body (required)
4494+
* @param callback The callback to be executed when the API call finishes
4495+
* @return The request call
4496+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
4497+
*/
4498+
public com.squareup.okhttp.Call describeServerGroupBackendServersAsync(DescribeServerGroupBackendServersRequest body, final ApiCallback<DescribeServerGroupBackendServersResponse> callback) throws ApiException {
4499+
4500+
ProgressResponseBody.ProgressListener progressListener = null;
4501+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
4502+
4503+
if (callback != null) {
4504+
progressListener = new ProgressResponseBody.ProgressListener() {
4505+
@Override
4506+
public void update(long bytesRead, long contentLength, boolean done) {
4507+
callback.onDownloadProgress(bytesRead, contentLength, done);
4508+
}
4509+
};
4510+
4511+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
4512+
@Override
4513+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
4514+
callback.onUploadProgress(bytesWritten, contentLength, done);
4515+
}
4516+
};
4517+
}
4518+
4519+
com.squareup.okhttp.Call call = describeServerGroupBackendServersValidateBeforeCall(body, progressListener, progressRequestListener);
4520+
Type localVarReturnType = new TypeToken<DescribeServerGroupBackendServersResponse>(){}.getType();
4521+
apiClient.executeAsync(call, localVarReturnType, callback);
4522+
return call;
4523+
}
43984524
/**
43994525
* Build call for describeServerGroups
44004526
* @param body (required)

0 commit comments

Comments
 (0)