地域
更新时间:2024-04-29
获取域名列表接口
使用以下代码可以获取全部地域或者指定地域的BBC域名列表:
import com.baidubce.BceClientConfiguration;
import com.baidubce.Protocol;
import com.baidubce.auth.DefaultBceCredentials;
import com.baidubce.services.bbc.BbcClient;
import com.baidubce.services.bbc.BbcClientConfiguration;
import com.baidubce.services.bcc.model.region.DescribeRegionsRequest;
import com.baidubce.services.bcc.model.region.DescribeRegionsResponse;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
String endpoint = "bbc.baidubce.com";
String ak = "ak";
String sk = "sk";
BceClientConfiguration bccClientConfiguration = new BccClientConfiguration()
.withProtocol(Protocol.HTTP)
.withCredentials(new DefaultBceCredentials(ak, sk))
.withEndpoint(endpoint);
BbcClient client = new BbcClient(bbcClientConfiguration);
DescribeRegionsRequest request = new DescribeRegionsRequest();
// 设置地域,若为空则返回所有地域的域名列表
request.setRegion("");
DescribeRegionsResponse response = client.describeRegions(request);
System.out.println(response.getRegions());
}
}