本文整理汇总了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;
}
示例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());
}
}