Java 类com.amazonaws.services.elastictranscoder.model.Pipeline 实例源码

项目:aws-utilization-monitor    文件:AwsScan.java   
/**
 * 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());
    }
}
项目:openbd-core    文件:List.java   
protected cfStructData getPipeline(Pipeline pipeline) throws cfmRunTimeException {
    cfStructData    s = new cfStructData();

    s.setData( "id", new cfStringData( pipeline.getId() ) );
    s.setData( "name", new cfStringData( pipeline.getName() ) );
    s.setData( "inputbucket", new cfStringData( pipeline.getInputBucket() ) );
    s.setData( "status", new cfStringData( pipeline.getStatus() ) );
    s.setData( "role", new cfStringData( pipeline.getRole() ) );
    s.setData( "arn", new cfStringData( pipeline.getArn() ) );
    s.setData( "awskey", new cfStringData( pipeline.getAwsKmsKeyArn()) );
    s.setData( "outputbucket", new cfStringData( pipeline.getOutputBucket()) );


    s.setData("contentconfig", getConfig(pipeline.getContentConfig()) );
    s.setData("thumbnailconfig", getConfig(pipeline.getThumbnailConfig()) );

    return s;
}
项目:s3_video    文件:AWSAdapter.java   
public String createPipeLineIfNotExist(String pipelineName, String regionName, 
                                     String inputBucketName, String outputBucketName,
                                     String iamRole,
                                     String topicArn,
                                     String storageClass) throws TranscodeException {
    //http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/pipeline-settings.html     
    try {
        transcoderClient.setRegion(Region.getRegion(Regions.fromName(regionName)));         

        ListPipelinesResult pipelinesResult = transcoderClient.listPipelines();
        List<Pipeline> pipelines = pipelinesResult.getPipelines();
        boolean isPipelineExist = false;
        String existingPipelineId = null;
        for (Pipeline p : pipelines){
            if (p.getName().equals(pipelineName)){
                isPipelineExist = true;
                existingPipelineId = p.getId();
            }
        }

        if (!isPipelineExist){
            Notifications notifications = new Notifications()
                .withCompleted(topicArn)
                .withError(topicArn)
                .withWarning(topicArn)
                .withProgressing(topicArn);

            PipelineOutputConfig pipelineOutputConfig = new PipelineOutputConfig();
            pipelineOutputConfig.setStorageClass(storageClass);
            pipelineOutputConfig.setBucket(outputBucketName);

            CreatePipelineRequest createPipelineRequest = new CreatePipelineRequest()
                                                                .withName(pipelineName)
                                                                .withInputBucket(inputBucketName)
                                                                .withRole(iamRole)
                                                                .withContentConfig(pipelineOutputConfig)
                                                                .withThumbnailConfig(pipelineOutputConfig)
                                                                .withNotifications(notifications);

            CreatePipelineResult result = transcoderClient.createPipeline(createPipelineRequest);
            return result.getPipeline().getId();
        } else {
            logger.debug(String.format("pipleline with name %s already exist", pipelineName));
            return existingPipelineId;
        }
    } catch (IllegalArgumentException ie) {
        logger.error("Couldn't get the region", ie);
        throw new TranscodeException(ie.getMessage());
    }
}
项目:openbd-core    文件:List.java   
public cfData execute( cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException{
    AmazonKey amazonKey = getAmazonKey(_session, argStruct);
    AmazonElasticTranscoder et = getAmazonElasticTranscoder(amazonKey);

    try{
        cfArrayData pipelines   = cfArrayData.createArray(1);

        ListPipelinesRequest listObjectsRequest = new ListPipelinesRequest();

        ListPipelinesResult lpr;

        do {
            lpr = et.listPipelines(listObjectsRequest);

            for (Pipeline pipeline : lpr.getPipelines())
                pipelines.addElement( getPipeline(pipeline) );

            listObjectsRequest.setPageToken( lpr.getNextPageToken() );
        } while ( listObjectsRequest.getPageToken() != null );

        return pipelines;

    }catch(Exception e){
        throwException(_session, "AmazonElasticTranscoder: " + e.getMessage() );
    }

    return cfBooleanData.TRUE; 
}