Example usage for com.amazonaws.services.elastictranscoder.model CreateJobRequest getPipelineId

List of usage examples for com.amazonaws.services.elastictranscoder.model CreateJobRequest getPipelineId

Introduction

In this page you can find the example usage for com.amazonaws.services.elastictranscoder.model CreateJobRequest getPipelineId.

Prototype


public String getPipelineId() 

Source Link

Document

The Id of the pipeline that you want Elastic Transcoder to use for transcoding.

Usage

From source file:org.alanwilliamson.amazon.transcoder.job.Create.java

License:Open Source License

public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException {
    AmazonKey amazonKey = getAmazonKey(_session, argStruct);
    AmazonElasticTranscoder et = getAmazonElasticTranscoder(amazonKey);

    CreateJobRequest cjr = new CreateJobRequest();

    cjr.setPipelineId(getNamedStringParam(argStruct, "pipelineid", null));
    if (cjr.getPipelineId() == null || cjr.getPipelineId().isEmpty())
        throwException(_session, "please provide a valid pipelineid");

    cjr.setOutputKeyPrefix(getNamedStringParam(argStruct, "outputkeyprefix", null));
    if (cjr.getOutputKeyPrefix() != null && cjr.getOutputKeyPrefix().isEmpty())
        throwException(_session, "please provide a valid outputkeyprefix");

    // Handle the input
    cfStructData input = getNamedStructParam(_session, argStruct, "input", null);
    if (input == null)
        throwException(_session, "please provide a 'input'");

    JobInput jobinput = new JobInput();

    if (input.containsKey("aspectratio"))
        jobinput.setAspectRatio(input.getData("aspectratio").getString());

    if (input.containsKey("container"))
        jobinput.setContainer(input.getData("container").getString());

    if (input.containsKey("framerate"))
        jobinput.setFrameRate(input.getData("framerate").getString());

    if (input.containsKey("interlaced"))
        jobinput.setInterlaced(input.getData("interlaced").getString());

    if (input.containsKey("key"))
        jobinput.setKey(input.getData("key").getString());

    if (input.containsKey("resolution"))
        jobinput.setResolution(input.getData("resolution").getString());

    if (input.containsKey("encryption"))
        jobinput.setEncryption(getEncryption((cfStructData) input.getData("encryption")));

    cjr.setInput(jobinput);//ww w  .j  a v a 2  s  . com

    // Set the output
    cfArrayData outputArr = getNamedArrayParam(_session, argStruct, "outputs", null);
    if (outputArr == null)
        throwException(_session, "please provide 'outputs'");

    List<CreateJobOutput> outputs = new LinkedList();
    for (int x = 0; x < outputArr.size(); x++)
        outputs.add(getCreateJobOutput((cfStructData) outputArr.getData(x + 1)));

    cjr.setOutputs(outputs);

    // Now after collection all that; create the actual pipeline
    try {
        CreateJobResult cpres = et.createJob(cjr);
        return new cfStringData(cpres.getJob().getId());
    } catch (Exception e) {
        throwException(_session, "AmazonElasticTranscoder: " + e.getMessage());
        return cfBooleanData.TRUE;
    }
}