Skip to content

Commit

Permalink
update to v0.10.138
Browse files Browse the repository at this point in the history
  • Loading branch information
friendshipbridge committed Nov 5, 2020
1 parent 8a6cc68 commit d924c09
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 11 deletions.
16 changes: 16 additions & 0 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
发行说明:记录每次SDK更新的说明,最新版本的SDK包含以前所有版本的更新内容。
---------------------------------------------------------------------
【版本:v0.10.138】
涉及产品:MCA,修改ResultItem实体类增加参数version。

【版本:v0.10.137】
涉及产品:CFC,修改invoke函数输入参数payload格式,改为byte[]。

【版本:v0.10.136】
涉及产品:BEC, 首次发布,可以通过调用API创建BEC虚机服务、获取BEC虚机服务列表、更新BEC虚机服务、获取BEC虚机服务详情、
操作BEC虚机服务、删除BEC虚机服务、获取BEC服务监控;获取BEC虚机列表、获取所在节点的BEC虚机列表、获取BEC虚机详情、删除BEC虚机、
更新BEC虚机资源、重装BEC虚机系统、操作BEC虚机资源、获取虚机服务监控、获取相同BEC虚机实例配置;创建Blb负载均衡、获取Blb负载均衡列表、
获取Blb详情、删除指定的Blb、更新指定的Blb、创建BLB监听设置、获取BLB监听设备列表、获取指定BLB指定监听端口的详情、修改BLB监听端口设置、
获取指定BEC LB后端绑定Pod/VM列表、获取指定BLB可绑定的部署StatefulSet/VmReplicas组、
获取指定的StatefulSet/VmReplicas后端可绑定的Pod/Vm组、为指定BLB绑定后端StatefulSet/VmReplicas、
修改指定BLB后端绑定容器组Pod/虚机组Vm的权重、获取BEC BLB 监控;获取用户总体概览信息、获取容器服务概览信息、
获取虚机服务概览信息、获取容器资源使用量走势、获取虚机资源使用量走势。

【版本:v0.10.135】
涉及产品:BOS,支持获取Bucket或特定前缀下的容量、object数、文件数

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.baidubce</groupId>
<artifactId>bce-java-sdk</artifactId>
<version>0.10.135</version>
<version>0.10.138</version>
<name>bce-sdk-java</name>
<description>The BCE SDK for Java provides Java APIs for all of BCE services.</description>
<url>http://bce.baidu.com/sdk/index.html</url>
Expand Down
25 changes: 22 additions & 3 deletions src/main/java/com/baidubce/services/cfc/CfcClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ public DeleteTriggerResponse deleteTrigger(DeleteTriggerRequest request) {
* @return
*/
public InvokeResponse invoke(String functionName, String invocationType, String logType, String qualifier,
Map<String, String> payload) {
byte[] payload) {
InvokeRequest request = new InvokeRequest()
.withFunctionName(functionName)
.withInvocationType(invocationType)
Expand Down Expand Up @@ -752,7 +752,7 @@ public InvokeResponse invoke(InvokeRequest request) {
if (request.getQualifier() != null) {
internalRequest.addParameter("Qualifier", request.getQualifier());
}
this.attachRequestToBody(request, internalRequest);
this.attachInvokeRequestToBody(internalRequest, request.getPayload());
GetInvokeResponse response = invokeHttpClient(internalRequest, GetInvokeResponse.class);
StringBuilder payload = new StringBuilder();
try {
Expand All @@ -769,7 +769,13 @@ public InvokeResponse invoke(InvokeRequest request) {
}
InvokeResponse invokeResponse = new InvokeResponse();
invokeResponse.setMetadata(response.getMetadata());
invokeResponse.setPayload(payload.toString());
byte[] payloadBytes;
try {
payloadBytes = JsonUtils.toJsonString(payload).getBytes(ENCODINGTYPE);
} catch (UnsupportedEncodingException e) {
throw new BceClientException(ENCODINGERR, e);
}
invokeResponse.setPayload(payloadBytes);
String logResult = response.getInvoke().getObjectMetadata().getBceLogResult();
if (logResult != "") {
invokeResponse.setBceLogResult(logResult);
Expand Down Expand Up @@ -821,9 +827,22 @@ private void attachRequestToBody(AbstractBceRequest request, InternalRequest htt
} catch (UnsupportedEncodingException e) {
throw new BceClientException(ENCODINGERR, e);
}

httpRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(content.length));
httpRequest.addHeader(Headers.CONTENT_TYPE, CONTENTTYPE);
httpRequest.setContent(RestartableInputStream.wrap(content));

}

/**
* put invoke payload into http body for put or post request.
* @param httpRequest json object of rest request
* @param payload http request object
*/
private void attachInvokeRequestToBody(InternalRequest httpRequest, byte[] payload) {
httpRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(payload.length));
httpRequest.addHeader(Headers.CONTENT_TYPE, CONTENTTYPE);
httpRequest.setContent(RestartableInputStream.wrap(payload));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class InvokeRequest extends AbstractBceRequest {
* Will call the function as input parameter
*/
@JsonProperty(value = "Payload")
private Map<String, String> Payload;
private byte[] Payload;

/**
* Get the function name
Expand Down Expand Up @@ -140,15 +140,15 @@ public void setQualifier(String qualifier) {
* @return The payload
*/
@JsonProperty(value = "Payload")
public Map<String, String> getPayload() {
public byte[] getPayload() {
return this.Payload;
}

/**
* Set the payload
* @param payload The payload
*/
public void setPayload(Map<String, String> payload) {
public void setPayload(byte[] payload) {
this.Payload = payload;
}

Expand All @@ -173,7 +173,7 @@ public InvokeRequest withQualifier(String qualifier) {
return this;
}

public InvokeRequest withPayload(Map<String, String> payload) {
public InvokeRequest withPayload(byte[] payload) {
this.setPayload(payload);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class InvokeResponse extends CfcResponse {
* Represent the result of invoking the user function
*/
@JsonProperty(value = "Payload")
private String Payload;
private byte[] Payload;

/**
* The log of invoking the user function
Expand All @@ -34,15 +34,15 @@ public class InvokeResponse extends CfcResponse {
* @return The result of invoking the user function
*/
@JsonProperty(value = "Payload")
public String getPayload() {
public byte[] getPayload() {
return Payload;
}

/**
* Set the result of invoking the user function
* @param payload The result of invoking the user function
*/
public void setPayload(String payload) {
public void setPayload(byte[] payload) {
Payload = payload;
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/baidubce/services/vca/model/ResultItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ResultItem {
private Double confidence;
private String source;
private List<TimeInSeconds> time;
private String version;

public Double getConfidence() {
return confidence;
Expand Down Expand Up @@ -51,13 +52,22 @@ public void setTime(List<TimeInSeconds> time) {
this.time = time;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ResultItem{");
sb.append("confidence=").append(confidence);
sb.append(", attribute='").append(attribute).append('\'');
sb.append(", source='").append(source).append('\'');
sb.append(", time='").append(time).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append('}');
return sb.toString();
}
Expand Down

0 comments on commit d924c09

Please sign in to comment.