本文整理汇总了Java中com.aliyuncs.profile.IClientProfile类的典型用法代码示例。如果您正苦于以下问题:Java IClientProfile类的具体用法?Java IClientProfile怎么用?Java IClientProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IClientProfile类属于com.aliyuncs.profile包,在下文中一共展示了IClientProfile类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: assumeRole
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
static AssumeRoleResponse assumeRole(String accessKeyId, String accessKeySecret,String roleArn, String roleSessionName, String policy,ProtocolType protocolType) throws ClientException {
try {
// 创建一个 Aliyun Acs Client, 用于发起 OpenAPI 请求
IClientProfile profile = DefaultProfile.getProfile(region_cn_hangzhou, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
// 创建一个 AssumeRoleRequest 并设置请求参数
final AssumeRoleRequest request = new AssumeRoleRequest();
request.setVersion(sta_api_version);
request.setMethod(MethodType.POST);
request.setProtocol(protocolType);
request.setRoleArn(roleArn);
request.setRoleSessionName(roleSessionName);
request.setPolicy(policy);
// 发起请求,并得到response
final AssumeRoleResponse response = client.getAcsResponse(request);
return response;
} catch (ClientException e) {
throw e;
}
}
开发者ID:xnx3,项目名称:xnx3,代码行数:21,代码来源:OSSUtil.java
示例2: getInstance
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
public static SMSUtil getInstance(String key){
if(BasicUtil.isEmpty(key)){
key = "default";
}
SMSUtil util = instances.get(key);
if(null == util){
util = new SMSUtil();
SMSConfig config = SMSConfig.getInstance(key);
util.config = config;
try {
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", config.ACCESS_KEY, config.ACCESS_SECRET);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms", "sms.aliyuncs.com");
util.client = new DefaultAcsClient(profile);
}
catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
}
instances.put(key, util);
}
return util;
}
开发者ID:anylineorg,项目名称:anyline,代码行数:23,代码来源:SMSUtil.java
示例3: assumeRole
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
static AssumeRoleResponse assumeRole(String accessKeyId, String accessKeySecret,
String roleArn, String roleSessionName, String policy,
ProtocolType protocolType) throws ClientException {
try {
// 创建一个 Aliyun Acs Client, 用于发起 OpenAPI 请求
IClientProfile profile = DefaultProfile.getProfile(REGION_CN_HANGZHOU, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
// 创建一个 AssumeRoleRequest 并设置请求参数
final AssumeRoleRequest request = new AssumeRoleRequest();
request.setVersion(STS_API_VERSION);
request.setMethod(MethodType.POST);
request.setProtocol(protocolType);
request.setRoleArn(roleArn);
request.setRoleSessionName(roleSessionName);
request.setPolicy(policy);
// 发起请求,并得到response
final AssumeRoleResponse response = client.getAcsResponse(request);
return response;
} catch (ClientException e) {
throw e;
}
}
开发者ID:aliyun,项目名称:sts-demo-simple-android-app,代码行数:27,代码来源:StsServiceImpl.java
示例4: assumeRole
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
static AssumeRoleResponse assumeRole(String id, String accessKeyId, String accessKeySecret, String roleArn,
String roleSessionName, String policy, ProtocolType protocolType) throws ClientException {
try {
// 创建一个 Aliyun Acs Client, 用于发起 OpenAPI 请求
IClientProfile profile = DefaultProfile.getProfile(_config.getConf(id, K_regionId), accessKeyId,
accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
// 创建一个 AssumeRoleRequest 并设置请求参数
final AssumeRoleRequest request = new AssumeRoleRequest();
request.setVersion(_config.getConf(id, K_api_version));
request.setMethod(MethodType.POST);
request.setProtocol(protocolType);
request.setRoleArn(roleArn);
request.setRoleSessionName(roleSessionName);
request.setPolicy(policy);
// 发起请求,并得到response
final AssumeRoleResponse response = client.getAcsResponse(request);
return response;
} catch (ClientException e) {
throw e;
}
}
开发者ID:dzh,项目名称:jframe,代码行数:27,代码来源:STSServiceImpl.java
示例5: assumeRole
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
static AssumeRoleResponse assumeRole(String accessKeyId, String accessKeySecret, String roleArn, String roleSessionName, String policy,
ProtocolType protocolType) throws ClientException {
try {
// 创建一个 Aliyun Acs Client, 用于发起 OpenAPI 请求
IClientProfile profile = DefaultProfile.getProfile(REGION_CN_HANGZHOU, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
// 创建一个 AssumeRoleRequest 并设置请求参数
final AssumeRoleRequest request = new AssumeRoleRequest();
request.setVersion(STS_API_VERSION);
request.setMethod(MethodType.POST);
request.setProtocol(protocolType);
request.setRoleArn(roleArn);
request.setRoleSessionName(roleSessionName);
request.setPolicy(policy);
// 发起请求,并得到response
final AssumeRoleResponse response = client.getAcsResponse(request);
return response;
} catch (ClientException e) {
throw e;
}
}
开发者ID:dzh,项目名称:jframe,代码行数:26,代码来源:StsServiceSample.java
示例6: getAssumeRoleCredentials
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
private Credentials getAssumeRoleCredentials(String policy)
throws com.aliyuncs.exceptions.ClientException {
IClientProfile profile = DefaultProfile
.getProfile(REGION, ACCESS_KEY, SECRET_KEY);
//DefaultProfile.addEndpoint("sts.us-west-1.aliyuncs.com", "us-west-1", "Sts", "sts.us-west-1.aliyuncs.com");
DefaultAcsClient client = new DefaultAcsClient(profile);
AssumeRoleRequest request = new AssumeRoleRequest();
request.setVersion(STS_API_VERSION);
request.setMethod(MethodType.POST);
request.setProtocol(ProtocolType.HTTPS);
request.setRoleArn(ROLE);
request.setRoleSessionName("test-session");
if (policy != null) {
request.setPolicy(policy);
}
AssumeRoleResponse stsResponse;
try {
stsResponse = client.getAcsResponse(request);
} catch (com.aliyuncs.exceptions.ClientException e) {
throw new RuntimeException(e);
}
String accessKey = stsResponse.getCredentials().getAccessKeyId();
String secretKey = stsResponse.getCredentials().getAccessKeySecret();
String stsToken = stsResponse.getCredentials().getSecurityToken();
assertNotNull(accessKey);
assertNotNull(secretKey);
assertNotNull(stsToken);
return stsResponse.getCredentials();
}
开发者ID:aliyun,项目名称:fc-java-sdk,代码行数:35,代码来源:FunctionComputeClientTest.java
示例7: SmsSenderAliyunImpl
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
public SmsSenderAliyunImpl(AdvancedAliyunOptions options) {
this.options = options;
try {
IClientProfile profile = DefaultProfile.getProfile(options.getArea(),
options.getAccessKey(),
options.getAccessSecret());
DefaultProfile.addEndpoint(options.getArea(), options.getArea(), "Sms", options.getSmsEndpoint());
client = new DefaultAcsClient(profile);
}
catch (Throwable e) {
throw new SmsException("Initialize the aliyun sms client failed.", e);
}
}
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:14,代码来源:SmsSenderAliyunImpl.java
示例8: onContextRefreshed
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
@Override
public void onContextRefreshed() {
if (validator.isEmpty(key) || validator.isEmpty(secret))
return;
try {
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", key, secret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com");
acsClient = new DefaultAcsClient(profile);
if (logger.isInfoEnable())
logger.info("初始化阿里云短信接口[{}]完成。", key);
} catch (Exception e) {
logger.warn(e, "初始化阿里云短信接口时发生异常!");
}
}
开发者ID:heisedebaise,项目名称:ranch,代码行数:16,代码来源:AliyunSmsSenderImpl.java
示例9: setSecurityInfo
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
public void setSecurityInfo(String accessKeyId, String secret) {
IClientProfile profile = DefaultProfile.getProfile(REGION_CN, accessKeyId, secret);
client = new DefaultAcsClient(profile);
bLogin = true;
}
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:6,代码来源:PhotoStoreClient.java
示例10: getAcsClient
import com.aliyuncs.profile.IClientProfile; //导入依赖的package包/类
@Override
public IAcsClient getAcsClient(String region) {
IClientProfile profile = DefaultProfile.getProfile(region, identity, credential);
return new DefaultAcsClient(profile);
}
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:6,代码来源:ECSApiImpl.java
注:本文中的com.aliyuncs.profile.IClientProfile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论