Skip to content

Commit

Permalink
update to v0.10.130
Browse files Browse the repository at this point in the history
  • Loading branch information
friendshipbridge committed Sep 15, 2020
1 parent b593856 commit 1bc5fb5
Show file tree
Hide file tree
Showing 20 changed files with 1,055 additions and 5 deletions.
13 changes: 11 additions & 2 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
发行说明:记录每次SDK更新的说明,最新版本的SDK包含以前所有版本的更新内容。
---------------------------------------------------------------------
【版本:vx.xx.xx】
涉及产品:SHC,新增广播接口,现有product接口增加asrKafka参数。
【版本:v0.10.130】
涉及产品:BVW(VideoWorks), 修改timeline对象。

【版本:v0.10.129】
涉及产品:SHC,新增广播接口,新增token接口,现有product接口增加可选参数asrKafka。

【版本:v0.10.128】
涉及产品:BVW(VideoWorks),新增Timeline对象

【版本:v0.10.127】
涉及产品:BILLING,新增资源账单查询接口

【版本:v0.10.126】
涉及产品:BVW(VideoWorks),支持视频快编合成和查询快编任务状态。
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.126</version>
<version>0.10.130</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
2 changes: 1 addition & 1 deletion src/main/java/com/baidubce/BceConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Common constants used by the whole SDK.
*/
public class BceConstants {
public static final String VERSION = "0.10.108";
public static final String VERSION = "0.10.127";

public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
public static final String DEFAULT_TIME_ZONE = "UTC";
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/baidubce/services/billing/BillingClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import com.baidubce.services.billing.model.ResourceMonthBillResponse;
import com.baidubce.services.billing.model.bill.PrepayShareBillRequest;
import com.baidubce.services.billing.model.bill.PrepayShareBillResponse;
import com.baidubce.services.billing.model.bill.ResourceBillListQueryRequest;
import com.baidubce.services.billing.model.bill.ResourceBillListQueryResponse;
import com.baidubce.services.billing.model.finance.SupervisorBalanceQueryRequest;
import com.baidubce.services.billing.model.finance.SupervisorBalanceResponse;
import com.baidubce.services.billing.model.finance.SupervisorBalanceTransferRequest;
Expand Down Expand Up @@ -189,6 +191,30 @@ public PrepayShareBillResponse queryPrepayShareBill(PrepayShareBillRequest reque
return invokeHttpClient(internalRequest, PrepayShareBillResponse.class);
}

/**
* Query the resource bill list
*
* @param request The request containing all options for getting the resource info.
* @return detailed resource bill list.
*/
public ResourceBillListQueryResponse getResourceBillList(ResourceBillListQueryRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");

checkIsTrue(!StringUtils.isEmpty(request.getBeginTime()) || !StringUtils.isEmpty(request.getEndTime())
|| !StringUtils.isEmpty(request.getBillMonth()),
"Parameters billMonth , beginTime and endTime cannot all be empty!");
checkIsTrue(!(StringUtils.isEmpty(request.getBeginTime()) && !StringUtils.isEmpty(request.getEndTime())),
"If parameter endTime is not empty, parameter beginTime cannot be empty!");
checkIsTrue(!(!StringUtils.isEmpty(request.getBeginTime()) && StringUtils.isEmpty(request.getEndTime())),
"If parameter beginTime is not empty, parameter endTime cannot be empty!");
checkStringNotEmpty(request.getProductType(), "The parameter productType should NOT be null");

InternalRequest internalRequest = createRequest(request, HttpMethodName.POST, VERSION_V1, BILL, RESOURCE, LIST);

return invokeHttpClient(internalRequest, ResourceBillListQueryResponse.class);

}

/**
* Query the order list
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.baidubce.services.billing.model.ResourceMonthBillResponse;
import com.baidubce.services.billing.model.bill.PrepayShareBillRequest;
import com.baidubce.services.billing.model.bill.PrepayShareBillResponse;
import com.baidubce.services.billing.model.bill.ResourceBillListQueryRequest;
import com.baidubce.services.billing.model.bill.ResourceBillListQueryResponse;
import com.baidubce.services.billing.model.finance.SupervisorBalanceQueryRequest;
import com.baidubce.services.billing.model.finance.SupervisorBalanceResponse;
import com.baidubce.services.billing.model.finance.SupervisorBalanceTransferRequest;
Expand Down Expand Up @@ -53,8 +55,8 @@ public class BillingExample {
private static final String ENDPOINT = "https://billing endpoint";
private static final String TEST_ACCOUNT_ID = "test id";


public static void main(String[] args) {
sampleForQueryResourceBillList();
sampleForQueryRenewResourceList();
// sampleForSetRenewResourceRule();
sampleForQueryPrepayShareBill();
Expand Down Expand Up @@ -112,6 +114,29 @@ private static void sampleForSetRenewResourceRule() {
System.out.println("==================================");
}

private static void sampleForQueryResourceBillList() {
BceCredentials credentials = new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
BillingClient client = new BillingClient(
new BillingClientConfiguration().withEndpoint(ENDPOINT).withCredentials(credentials)
);

ResourceBillListQueryRequest request = new ResourceBillListQueryRequest();
request.setBillMonth("2020-08");
request.setProductType("prepay");
request.setPageNo(1);
request.setPageSize(10);

ResourceBillListQueryResponse response = client.getResourceBillList(request);

System.out.println("==================================");
System.out.println("sampleForQueryResourceBillList ResourceBillListQueryResponse result:");
System.out.println(" accountId: " + response.getAccountId());
System.out.println(" month: " + response.getBillMonth());
System.out.println(" size: " + response.getTotalCount());
System.out.println(" bills: " + response.getBills());
System.out.println("==================================");
}

private static void sampleForQueryPrepayShareBill() {
BceCredentials credentials = new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
BillingClient client = new BillingClient(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.baidubce.services.billing.model.bill;

import java.math.BigDecimal;

import lombok.Data;

/**
* the bill of the charge item
*/
@Data
public class ChargeItemBill {

/**
* the charge item ,like RunningTimeMinutes
*/
private String chargeItem;

/**
* the charge item ,like 运行时间
*/
private String chargeItemDesc;

/**
* the usage amount of the charge item
*/
private String amount;

/**
* the amount unit of the charge item
*/
private String amountUnit;

/**
* the bill price of the charge item
*/
private BigDecimal originPrice;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.baidubce.services.billing.model.bill;

import java.math.BigDecimal;
import java.util.List;

import lombok.Data;

/**
* the bill of resource
*/
@Data
public class ResourceBill {

/**
* the name of service
*/
private String serviceType;

/**
* chinese name of service
*/
private String serviceTypeName;

/**
* the pay type
*/
private String productType;

/**
* the id of the resource
*/
private String instanceId;

/**
* the short id of the resource
*/
private String shortId;

/**
* the region of the resource
*/
private String region;

/**
* the price of the bill
*/
private BigDecimal originPrice;

/**
* the tag info of the resource
*/
private String tag;

/**
* the detail info if the resource is a postpay resource
*/
private List<ResourceBillPostpayDetail> postpayDetails;

/**
* the detail info if the resource is a pretpay resource
*/
private List<ResourceBillPrepayDetail> prepayDetails;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.baidubce.services.billing.model.bill;

import com.baidubce.auth.BceCredentials;
import com.baidubce.model.AbstractBceRequest;

import lombok.Data;

/**
* request model for query resource bill list
*/
@Data
public class ResourceBillListQueryRequest extends AbstractBceRequest {

/**
* the month of bill, query by month
*/
private String billMonth;

/**
* the begin time of bill, query by day
*/
private String beginTime;

/**
* the end time of bill, query by day
*/
private String endTime;

/**
* pay type : prepay/postpay
*/
private String productType;

/**
* the type of service
*/
private String serviceType;

/**
* the resource instance id or resource short id
*/
private String shortOrInstanceId;

/**
* the account id you want to query
* tips: only the master account of organization group can set the parameter to query the sub account's bill
*/
private String queryAccountId;

/**
* page number
*/
Integer pageNo;

/**
* page size
*/
Integer pageSize;

/**
* Configure request credential for the request.
*
* @param credentials a valid instance of BceCredentials.
* @return BindTagsRequest with credentials.
*/
@Override
public ResourceBillListQueryRequest withRequestCredentials(BceCredentials credentials) {
this.setRequestCredentials(credentials);
return this;
}

}
Loading

0 comments on commit 1bc5fb5

Please sign in to comment.