当前位置: 首页>>代码示例>>Java>>正文


Java SystemPropertiesCredentialsProvider类代码示例

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


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

示例1: getCredentialProviderC

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
public static AWSCredentialsProvider getCredentialProviderC(Parameters config){
  List<AWSCredentialsProvider> providers = new ArrayList<AWSCredentialsProvider>();
  
  if ("YES".equals(config.get("aws.credentials.instaneProfile")))
    providers.add(new InstanceProfileCredentialsProvider());
  if ("YES".equals(config.get("aws.credentials.environmentVariable")))
    providers.add(new EnvironmentVariableCredentialsProvider());
  if ("YES".equals(config.get("aws.credentials.systemProperties")))
    providers.add(new SystemPropertiesCredentialsProvider());
  
  String accessKey = config.get("aws.credentials.accessKey").toString();
  String secretKey = config.get("aws.credentials.secretKey").toString();
  
  if (accessKey != null && accessKey.length() > 0){
    providers.add(new AWSCredentialsConfigFileProvider(accessKey, secretKey));
  }
  
  return new AWSCredentialsProviderChain(providers.toArray(new AWSCredentialsProvider[0]));
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:20,代码来源:AwsUtils.java

示例2: getAWSCredentialsProviderChain

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
public static AWSCredentialsProviderChain getAWSCredentialsProviderChain() {
    String cerberusRoleToAssume = System.getenv(CERBERUS_ASSUME_ROLE_ARN) != null ?
            System.getenv(CERBERUS_ASSUME_ROLE_ARN) : "";
    String cerberusRoleToAssumeExternalId = System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID) != null ?
            System.getenv(CERBERUS_ASSUME_ROLE_EXTERNAL_ID) : "";

    STSAssumeRoleSessionCredentialsProvider sTSAssumeRoleSessionCredentialsProvider =
            new STSAssumeRoleSessionCredentialsProvider
                    .Builder(cerberusRoleToAssume, UUID.randomUUID().toString())
                    .withExternalId(cerberusRoleToAssumeExternalId)
                    .build();

    AWSCredentialsProviderChain chain = new AWSCredentialsProviderChain(
            new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new ProfileCredentialsProvider(),
            sTSAssumeRoleSessionCredentialsProvider,
            new InstanceProfileCredentialsProvider());

    return chain;
}
 
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:22,代码来源:CerberusModule.java

示例3: init

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
@Override
public void init(Configuration conf, String keyPrefix) {
  bucketName = conf.get(keyPrefix + S3_BUCKET_NAME);
  String endpoint = conf.get(keyPrefix + S3_ENDPOINT_NAME);
  String key = conf.get(keyPrefix + S3_ACCESS_KEY);
  String secret = conf.get(keyPrefix + S3_ACCESS_SECRET);

  System.setProperty(SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY, key);
  System.setProperty(SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY, secret);
  AWSCredentialsProvider provider = new SystemPropertiesCredentialsProvider();
  client = new AmazonS3Client(provider);
  client.setEndpoint(endpoint);
  override = conf.getBoolean(keyPrefix + "override", true);
  acls = new AccessControlList();
  acls.grantPermission(GroupGrantee.AllUsers, Permission.FullControl);
  acls.grantPermission(GroupGrantee.AllUsers, Permission.Read);
  acls.grantPermission(GroupGrantee.AllUsers, Permission.Write);
}
 
开发者ID:XiaoMi,项目名称:galaxy-fds-migration-tool,代码行数:19,代码来源:S3Source.java

示例4: getInstance

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
public static AmazonS3Manager getInstance() {
	if (instance == null) {
		synchronized (AmazonS3Manager.class) {
			if (instance == null) {
				instance = new AmazonS3Manager();
				String accessKey = Configuration.get(Parameter.ACCESS_KEY_ID);
				String secretKey = Configuration.get(Parameter.SECRET_KEY);
				
				System.setProperty("aws.accessKeyId", accessKey);
				System.setProperty("aws.secretKey", secretKey);

				s3client = new AmazonS3Client(new SystemPropertiesCredentialsProvider());

				
			}
		}
	}
	return instance;
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:20,代码来源:AmazonS3Manager.java

示例5: ApiImporter

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public ApiImporter(String profile, String accessKey, String secret) {
	if (accessKey != null && secret != null) {
		credentialsProvider=new AWSCredentialsProvider() {
			
			@Override
			public void refresh() {
			}
			
			@Override
			public AWSCredentials getCredentials() {
				return new AWSCredentials() {
					
					@Override
					public String getAWSSecretKey() {
						return secret;
					}
					
					@Override
					public String getAWSAccessKeyId() {
						return accessKey;
					}
				};
			}
		};
	} else {
		credentialsProvider = new AWSCredentialsProviderChain(new EnvironmentVariableCredentialsProvider(),
				new SystemPropertiesCredentialsProvider(), new ProfileCredentialsProvider(profile),
				new InstanceProfileCredentialsProvider());
	}
	amazonApiGatewayClient = new AmazonApiGatewayClient(credentialsProvider);
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:33,代码来源:ApiImporter.java

示例6: MyCredentialsProvider

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
MyCredentialsProvider() {
    super(new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            // Removed due to ElasticBeanstalk environment not being setup with a profile dir
            // new ProfileCredentialsProvider(),
            new InstanceProfileCredentialsProvider(),
            new ClasspathPropertiesFileCredentialsProvider());
}
 
开发者ID:awslabs,项目名称:aws-iot-mqtt-load-generator,代码行数:9,代码来源:MyCredentialsProvider.java

示例7: AuthenticationInfoAWSCredentialsProviderChain

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
AuthenticationInfoAWSCredentialsProviderChain(AuthenticationInfo authenticationInfo) {
    super(
            new InstanceProfileCredentialsProvider(),
            new ProfileCredentialsProvider(),
            new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new InstanceProfileCredentialsProvider());
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:9,代码来源:AuthenticationInfoAWSCredentialsProviderChain.java

示例8: deploy

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
@TaskAction
protected void deploy() {
    String versionLabel = getVersionLabel();

    AWSCredentialsProviderChain credentialsProvider = new AWSCredentialsProviderChain(new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new ProfileCredentialsProvider(beanstalk.getProfile()));

    BeanstalkDeployer deployer = new BeanstalkDeployer(beanstalk.getS3Endpoint(), beanstalk.getBeanstalkEndpoint(), credentialsProvider);

    File warFile = getProject().files(war).getSingleFile();
    deployer.deploy(warFile, deployment.getApplication(), deployment.getEnvironment(), deployment.getTemplate(), versionLabel);
}
 
开发者ID:EvidentSolutions,项目名称:gradle-beanstalk-plugin,代码行数:12,代码来源:DeployTask.java

示例9: getCredentials

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
/**
 * 
 * @return
 */
private AWSCredentialsProvider getCredentials() {
  return new AWSCredentialsProviderChain(new StaticCredentialsProvider(
      new AppenderCredentials()), new SystemPropertiesCredentialsProvider(),
      new EnvironmentVariableCredentialsProvider(),
      new ProfileCredentialsProvider(),
      new InstanceProfileCredentialsProvider());
}
 
开发者ID:scizeron,项目名称:logback-sqs,代码行数:12,代码来源:SqsAppender.java

示例10: credentials

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
@Bean
@Scope(WebApplicationContext.SCOPE_APPLICATION)
public AWSCredentialsProvider credentials() {
    return new AWSCredentialsProviderChain(
          new InstanceProfileCredentialsProvider(),
          new EnvironmentVariableCredentialsProvider(),
          new SystemPropertiesCredentialsProvider()
            );
}
 
开发者ID:awslabs,项目名称:amediamanager,代码行数:10,代码来源:ServerConfig.java

示例11: createCredentialsProvider

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
private AWSCredentialsProvider createCredentialsProvider(){
  return new AWSCredentialsProviderChain(
      new InstanceProfileCredentialsProvider(),
      new EnvironmentVariableCredentialsProvider(),
      new SystemPropertiesCredentialsProvider(),
      new AWSCredentialsConfigFileProvider()
      );
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:9,代码来源:AwsServiceImpl.java

示例12: DefaultAWSCredentialsProviderChain

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
DefaultAWSCredentialsProviderChain(Config config) {
  super(new EnvironmentVariableCredentialsProvider(),
          new SystemPropertiesCredentialsProvider(),
          new ConfigurationCredentialsProvider(config),
          new ProfileCredentialsProvider(),
          new InstanceProfileCredentialsProvider());
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:8,代码来源:AWSClusterSecurityManager.java

示例13: getCredentials

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
public AWSCredentialsProvider getCredentials(AWSCredentials credentials) {
    return new AWSCredentialsProviderChain(
            new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new StaticCredentialsProvider(credentials == null ? new NullCredentials() : credentials),
            new ProfileCredentialsProvider(),
            new InstanceProfileCredentialsProvider()
    );
}
 
开发者ID:trautonen,项目名称:logback-ext,代码行数:10,代码来源:AwsSupport.java

示例14: CustomCredentialsProviderChain

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
public CustomCredentialsProviderChain(ClientConfiguration clientConfiguration, ProfileIdentifier profile, Supplier<MFAToken> mfaTokenSupplier) {
    super(new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new ProfileCredentialProvider(clientConfiguration, profile, mfaTokenSupplier),
            new EC2ContainerCredentialsProviderWrapper());
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:7,代码来源:CustomCredentialsProviderChain.java

示例15: write

import com.amazonaws.auth.SystemPropertiesCredentialsProvider; //导入依赖的package包/类
@Override
public String write(String baseFolder, MultipartFile file, String fileName) {

	String webPath = baseFolder + "/" + fileName;

	AmazonS3 s3client = new AmazonS3Client(new SystemPropertiesCredentialsProvider());
	try {
		System.out.println("Uploading a new object to S3 from a file\n");
		s3client.putObject(new PutObjectRequest(bucketName, webPath, convert(file)));

	} catch (AmazonServiceException ase) {
		System.out.println("Caught an AmazonServiceException, which " + "means your request made it "
				+ "to Amazon S3, but was rejected with an error response" + " for some reason.");
		System.out.println("Error Message:    " + ase.getMessage());
		System.out.println("HTTP Status Code: " + ase.getStatusCode());
		System.out.println("AWS Error Code:   " + ase.getErrorCode());
		System.out.println("Error Type:       " + ase.getErrorType());
		System.out.println("Request ID:       " + ase.getRequestId());
	} catch (AmazonClientException ace) {
		System.out.println("Caught an AmazonClientException, which " + "means the client encountered "
				+ "an internal error while trying to " + "communicate with S3, "
				+ "such as not being able to access the network.");
		System.out.println("Error Message: " + ace.getMessage());
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	return webPath;

	// System.out.println(context.getContextPath());
	// System.out.println(context.getRealPath(context.getContextPath()));
	//
	// String homePath = System.getProperty("user.home");
	// String baseFolderPath = homePath + "/" + baseFolder;
	//
	// File folder = new File(baseFolderPath);
	// if (! folder.exists())
	// folder.mkdirs();
	//
	// String filePath = baseFolderPath + "/" + file.getOriginalFilename();
	//
	// System.out.println(filePath);
	//
	// try {
	// file.transferTo(new File(filePath));
	// return filePath;
	// } catch (IllegalStateException | IOException e) {
	// e.printStackTrace();
	// throw new RuntimeException(e);
	// }
}
 
开发者ID:ismartonline,项目名称:ismartonline,代码行数:53,代码来源:AwsFileManager.java


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