/** * Collect data for ElasticTranscoder. * * @param stats * current statistics object. * @param account * currently used credentials object. * @param region * currently used aws region. */ public static void scanElasticTranscoder(AwsStats stats, AwsAccount account, Regions region) { if (region == Regions.EU_CENTRAL_1) return; LOG.debug("Scan for ElasticTranscoder in region " + region.getName() + " in account " + account.getAccountId()); try { AmazonElasticTranscoder elasticTranscoder = new AmazonElasticTranscoderClient(account.getCredentials()); elasticTranscoder.setRegion(Region.getRegion(region)); List<Pipeline> list = elasticTranscoder.listPipelines().getPipelines(); int totalItems = list.size(); for (Pipeline pipeline : list) { AwsResource res = new AwsResource(pipeline.getName(), account.getAccountId(), AwsResourceType.ElasticTranscoder, region); res.addInfo(AwsTag.Arn, pipeline.getArn()); stats.add(res); } LOG.info(totalItems + " Elastic Transcoder pipelines in region " + region.getName() + " in account " + account.getAccountId()); } catch (AmazonServiceException ase) { LOG.error("Exception of ElasticTranscoder: " + ase.getMessage()); } }
/** * Returns back the necessary AmazonElasticTranscoder class for interacting with Elastic Transcoder * @param amazonKey * @return * @throws cfmRunTimeException */ public AmazonElasticTranscoder getAmazonElasticTranscoder( AmazonKey amazonKey ) throws cfmRunTimeException{ BasicAWSCredentials awsCreds = new BasicAWSCredentials(amazonKey.getKey(), amazonKey.getSecret()); AmazonElasticTranscoder et = new AmazonElasticTranscoderClient(awsCreds); et.setRegion( amazonKey.getAmazonRegion().toAWSRegion() ); return et; }
@Bean( destroyMethod = "shutdown" ) AmazonElasticTranscoder amazonElasticTranscoderClient() { return this.awsRegion().createClient( AmazonElasticTranscoderClient.class, this.awsCredentials(), new ClientConfiguration() ); }
@Bean @Scope(WebApplicationContext.SCOPE_APPLICATION) public AmazonElasticTranscoder transcodeClient(final AWSCredentialsProvider creds, final Region region) { return region.createClient(AmazonElasticTranscoderClient.class, creds, null); }