• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultBceCredentials类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.baidubce.auth.DefaultBceCredentials的典型用法代码示例。如果您正苦于以下问题:Java DefaultBceCredentials类的具体用法?Java DefaultBceCredentials怎么用?Java DefaultBceCredentials使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultBceCredentials类属于com.baidubce.auth包,在下文中一共展示了DefaultBceCredentials类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
@PostConstruct
public void init() {
    location = Enum.valueOf(StoreLocation.class, coreConfig.getValue("app.upload.file.store"));
    switch (location) {
        case Cloud: {
            apikey = coreConfig.getValue("bae.app.apikey");
            secretKey = coreConfig.getValue("bae.app.secretkey");
            bucket = coreConfig.getValue("bae.bcs.bucket");

            BosClientConfiguration config = new BosClientConfiguration();
            config.setCredentials(new DefaultBceCredentials(apikey, secretKey));
            config.setEndpoint(host);
            // config.setEndpoint(coreConfig.getValue("app.domain"));
            // 设置HTTP最大连接数为10
            config.setMaxConnections(10);
            bosClient = new BosClient(config);
            break;
        }
        case FastDFS: {
            fastdfsClient = FastdfsClientFactory.getFastdfsClient();
            break;
        }
    }
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:25,代码来源:AppFileUtils.java


示例2: main

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public static void main(String[] args) {
    BceCredentials credentials = new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
    StsClient client = new StsClient(
            new BceClientConfiguration().withEndpoint(ENDPOINT).withCredentials(credentials)
    );
    GetSessionTokenResponse response = client.getSessionToken(new GetSessionTokenRequest());
    // or simply call:
    // GetSessionTokenResponse response = client.getSessionToken();
    // or you can specify limited permissions with ACL:
    // GetSessionTokenResponse response = client.getSessionToken(new GetSessionTokenRequest().withAcl("blabla"));

    // build DefaultBceSessionCredentials object from response:
    BceCredentials tempCredentials = new DefaultBceSessionCredentials(
            response.getAccessKeyId(),
            response.getSecretAccessKey(),
            response.getSessionToken());
    System.out.println("==================================");
    System.out.println("GetSessionToken result:");
    System.out.println("    accessKeyId:  " + response.getAccessKeyId());
    System.out.println("    secretAccessKey:  " + response.getSecretAccessKey());
    System.out.println("    securityToken:  " + response.getSessionToken());
    System.out.println("    expiresAt:  " + response.getExpiration().toString());
    System.out.println("==================================");
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:25,代码来源:StsExample.java


示例3: BaiduBOSImpl

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public BaiduBOSImpl(BaiduBOSConfig baiduBOSConfig) {
	this.baiduBOSConfig = baiduBOSConfig;
	BosClientConfiguration config = new BosClientConfiguration();
	config.setCredentials(
			new DefaultBceCredentials(baiduBOSConfig.getAccessKeyId(), baiduBOSConfig.getAccessKeySecret()));
	config.setEndpoint(baiduBOSConfig.getEndPoint());
	bosClient = new BosClient(config);
}
 
开发者ID:MinsxCloud,项目名称:minsx-ccs,代码行数:9,代码来源:BaiduBOSImpl.java


示例4: initial

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
@Before
public void initial() {
	BosClientConfiguration config = new BosClientConfiguration();
	config.setEndpoint("http://su.bcebos.com");
    config.setCredentials(new DefaultBceCredentials("c93dd9d3411740419a0ff0f16cfce2fc", "c7244fc343a8474682663f0a31d4d798"));
    bosClient = new BosClient(config);
}
 
开发者ID:MinsxCloud,项目名称:minsx-ccs,代码行数:8,代码来源:BosTest.java


示例5: getClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public static BosClient getClient(){
		 // 初始化一个BosClient
	    BosClientConfiguration config = new BosClientConfiguration();
//	    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID,SECRET_ACCESS_KEY));
//	    config.setEndpoint(ENDPOINT);
	    config.setCredentials(new DefaultBceCredentials(DiaowenProperty.ACCESS_KEY_ID,DiaowenProperty.SECRET_ACCESS_KEY));
	    config.setEndpoint(DiaowenProperty.ENDPOINT);
	    BosClient client = new BosClient(config);
	    return client;
	}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:11,代码来源:BaiduBOS.java


示例6: main

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    AppFileUtils utils = new AppFileUtils();
    utils.apikey = "e46c7e6c281a4d3da7545c685bb5db1c";
    utils.secretKey = "89d1c208bee145f49ca88ef1bbd12302";
    utils.bucket = "onegymbucket";
    utils.location = StoreLocation.Disk;
    BosClientConfiguration config = new BosClientConfiguration();
    config.setCredentials(new DefaultBceCredentials(utils.apikey, utils.secretKey));
    config.setEndpoint(host);
    // config.setEndpoint(coreConfig.getValue("app.domain"));
    // 设置HTTP最大连接数为10
    config.setMaxConnections(10);
    BosClient bosClient = new BosClient(config);
    // 构造ListObjectsRequest请求
    ListObjectsRequest listObjectsRequest = new ListObjectsRequest(utils.bucket);
    // 递归列出fun目录下的所有文件
    listObjectsRequest.setPrefix("static/uploadFiles/manager1/2015-11-12");
    ListObjectsResponse listing = bosClient.listObjects(listObjectsRequest);
    // 遍历所有Object
    System.out.println("Objects:");
    for (BosObjectSummary objectSummary : listing.getContents()) {
        System.out.println(objectSummary.getKey());
    }

    System.out.println(StringUtils.substringAfterLast("http://bj.bcebos.com/v1/onegymbucket/static/uploadFiles/manager1/2015-11-12/483bdc2b9ee8413d99e91293237615c9/ccc.jpg", "onegymbucket/"));

    String fileUrl = "http://10.87.13.157:9011/fileWeb/CSAOFWeb/魏总2修.jpg";
    URL url = new URL(FilenameUtils.getFullPath(fileUrl) + Encodes.urlEncode(getFileName(fileUrl)));
    String storeFile = "D:\\data\\files\\images\\oa\\news\\魏总2修1111111111111.jpg";
    FileUtils.copyURLToFile(url, new File(storeFile));
    utils.uploadCompressImage(new File(storeFile), 0.7f, "D:\\data\\files\\images\\oa\\news\\");
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:33,代码来源:AppFileUtils.java


示例7: main

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	    String ENDPOINT = "http://bj.bcebos.com";
	    BosClientConfiguration config = new BosClientConfiguration();
	    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
	    config.setEndpoint(ENDPOINT);
	    BosClient client = new BosClient(config);	    
//	    File targetFile = new File("C:\\Users\\lenovo\\Desktop\\清华大学MBA.txt");
//	    String storePath = "/static/test/";
//	    putObject(client, targetFile, storePath);
//	    deleteObject(client, "http://bj.bcebos.com/v1/onegymbucket/static/test/aaa.jpg");
        //上传url文件
        String fileurl = "http://bj.bcebos.com/v1/onegymbucket/static/uploadFiles/manager1/2015-10-28/e082e0bfc93d40d29b62afd087ee9f88/logo.jpg";
        String uploadedUrl =uploadFromUrl(client, BUCKET, fileurl, AppFileUtils.getFileBaseName(fileurl), "/static/uploadFiles/");
        System.out.println("uploadedUrl is: "+uploadedUrl);
	}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:16,代码来源:BCE.java


示例8: initialize

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
@PostConstruct
private void initialize() {
  this.bucket = configuration.getBucket();
  BosClientConfiguration config = new BosClientConfiguration();
  config.setCredentials(new DefaultBceCredentials(configuration.getAccessKey(), configuration.getSecretKey()));
  config.setEndpoint(configuration.getEndPoint());
  bos = new BosClient(config);
}
 
开发者ID:perrywang,项目名称:dionysus,代码行数:9,代码来源:BOSService.java


示例9: BOSService

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public BOSService(BOSServiceBuilder builder) {
  this.bucket = builder.getBucket();
  BosClientConfiguration config = new BosClientConfiguration();
  BceCredentials credential = new DefaultBceCredentials(builder.getAccessKey(),
      builder.getSecretKey());
  config.setCredentials(credential);
  config.setEndpoint(builder.getEndPoint());
  bos = new BosClient(config);
}
 
开发者ID:perrywang,项目名称:dionysus,代码行数:10,代码来源:BOSService.java


示例10: init

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
@PostConstruct
public void init() {
    BosClientConfiguration config = new BosClientConfiguration();
    config.setCredentials(new DefaultBceCredentials(key, secret));
    config.setEndpoint(url);
    client = new BosClient(config);
}
 
开发者ID:chocotan,项目名称:lolibox,代码行数:8,代码来源:BaiduStorageService.java


示例11: RuleEngineClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public RuleEngineClient(String accessKey, String secretKey) {
    this(new BceClientConfiguration()
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey))
            .withEndpoint(ENDPOINT));
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:RuleEngineClient.java


示例12: IotSmsReceiverClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public IotSmsReceiverClient(String accessKey, String secretKey) {
    this(new BceClientConfiguration()
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey))
            .withEndpoint(ENDPOINT));
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:IotSmsReceiverClient.java


示例13: IotTimerClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public IotTimerClient(String accessKey, String secretKey) {
    this(new BceClientConfiguration()
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey))
            .withEndpoint(ENDPOINT));
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:IotTimerClient.java


示例14: createCertClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public static CertClient createCertClient(String accessKey, String secretKey, String endpoint) {
    BceClientConfiguration bceClientConfiguration = new BceClientConfiguration().withEndpoint(endpoint)
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey));
    return new CertClient(accessKey, secretKey, bceClientConfiguration, false);
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:CertClient.java


示例15: IotAlarmClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public IotAlarmClient(String accessKey, String secretKey) {
    this(new BceClientConfiguration()
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey))
            .withEndpoint(ENDPOINT));
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:IotAlarmClient.java


示例16: BinaryParserClient

import com.baidubce.auth.DefaultBceCredentials; //导入依赖的package包/类
public BinaryParserClient(String accessKey, String secretKey) {
    this(new BceClientConfiguration()
            .withCredentials(new DefaultBceCredentials(accessKey, secretKey))
            .withEndpoint(ENDPOINT));
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:6,代码来源:BinaryParserClient.java



注:本文中的com.baidubce.auth.DefaultBceCredentials类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShapePickSupport类代码示例发布时间:2022-05-23
下一篇:
Java LoginModuleControlFlag类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap