全部产品
云市场

初始化

更新时间:2019-03-01 21:01:27

前置条件

初始化

点播服务的接入区域参考 接入区域标识,如国内请使用 cn-shanghai

  1. import com.aliyuncs.profile.DefaultProfile;
  2. import com.aliyuncs.DefaultAcsClient;
  3. import com.aliyuncs.exceptions.ClientException;
  4. public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) throws ClientException {
  5. String regionId = "cn-shanghai"; // 点播服务接入区域
  6. DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
  7. DefaultAcsClient client = new DefaultAcsClient(profile);
  8. return client;
  9. }
  • 使用 STS 初始化
  1. import com.aliyuncs.profile.DefaultProfile;
  2. import com.aliyuncs.DefaultAcsClient;
  3. import com.aliyuncs.exceptions.ClientException;
  4. public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret, String securityToken) throws ClientException {
  5. String regionId = "cn-shanghai"; // 点播服务接入区域
  6. DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret, securityToken);
  7. DefaultAcsClient client = new DefaultAcsClient(profile);
  8. return client;
  9. }