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


Java Notifications类代码示例

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


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

示例1: provisionPipeline

import com.amazonaws.services.elastictranscoder.model.Notifications; //导入依赖的package包/类
private String provisionPipeline() {
    String pipelineId = config.getProperty(ConfigProps.TRANSCODE_PIPELINE);

    if (pipelineId == null) {
    	LOG.info("Provisioning ETS Pipeline.");
        state = ProvisionState.PROVISIONING;
        Notifications notifications = new Notifications()
            .withError(config.getProperty(ConfigProps.TRANSCODE_TOPIC))
            .withCompleted(config.getProperty(ConfigProps.TRANSCODE_TOPIC))
            .withProgressing("")
            .withWarning("");

        CreatePipelineRequest pipelineRequest = new CreatePipelineRequest()
            .withName("amm-reinvent-pipeline-" + UUID.randomUUID().toString().replace("-", "").substring(0, 18).toUpperCase())
            .withRole(config.getProperty(ConfigProps.TRANSCODE_ROLE))
            .withInputBucket(config.getProperty(ConfigProps.S3_UPLOAD_BUCKET))
            .withOutputBucket(config.getProperty(ConfigProps.S3_UPLOAD_BUCKET))
            .withNotifications(notifications);

        try {
            CreatePipelineResult pipelineResult = transcoderClient.createPipeline(pipelineRequest);
            pipelineId = pipelineResult.getPipeline().getId();
            LOG.info("Pipeline {} created. Persisting to configuration provider.", pipelineId);
            config.getConfigurationProvider().persistNewProperty(ConfigProps.TRANSCODE_PIPELINE, pipelineId);
        } catch (AmazonServiceException e) {
            LOG.error("Failed creating pipeline {}", pipelineRequest.getName(), e);
            state = ProvisionState.UNPROVISIONED;
        }
    }
    return pipelineId;
}
 
开发者ID:awslabs,项目名称:amediamanager,代码行数:32,代码来源:ElasticTranscoderPipelineResource.java

示例2: createPipeLineIfNotExist

import com.amazonaws.services.elastictranscoder.model.Notifications; //导入依赖的package包/类
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());
    }
}
 
开发者ID:TimShi,项目名称:s3_video,代码行数:51,代码来源:AWSAdapter.java


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