Example usage for com.amazonaws.services.datapipeline DataPipelineClient DataPipelineClient

List of usage examples for com.amazonaws.services.datapipeline DataPipelineClient DataPipelineClient

Introduction

In this page you can find the example usage for com.amazonaws.services.datapipeline DataPipelineClient DataPipelineClient.

Prototype

DataPipelineClient(AwsSyncClientParams clientParams) 

Source Link

Document

Constructs a new client to invoke service methods on AWS Data Pipeline using the specified parameters.

Usage

From source file:com.shazam.dataengineering.pipelinebuilder.DeploymentAction.java

License:Apache License

public boolean oldPipelineHasRunningTasks() {
    DataPipelineClient client = new DataPipelineClient(credentials);
    AWSProxy proxy = new AWSProxy(client);

    return proxy.hasRunningTasks(pipelineToRemoveId);
}

From source file:com.shazam.dataengineering.pipelinebuilder.DeploymentAction.java

License:Apache License

public void doConfirmProcess(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
    // Clear out previous warnings
    clientMessages.clear();//from  w  ww  .  ja va2 s . c om

    JSONObject formData = req.getSubmittedForm();
    pipelineFile = formData.getString("pipeline");
    String startDate = formData.getString("scheduleDate");

    // Validate start date, and warn if its in the past.
    if (!PipelineObject.validateDate(startDate)) {
        clientMessages.add(
                "[ERROR] Passed start date was not in expected format: " + PipelineObject.PIPELINE_DATE_FORMAT);
        req.getView(this, "error").forward(req, resp);
    } else if (PipelineObject.isPast(startDate)) {
        clientMessages.add("[WARN] Passed start date is in the past. Backfill may occur.");
    }

    // Validate chosen pipeline
    pipelineObject = getPipelineByName(pipelineFile);
    if (pipelineObject == null) {
        clientMessages.add("[ERROR] Pipeline not found");
        req.getView(this, "error").forward(req, resp);
    } else {
        pipelineObject.setScheduleDate(startDate);
    }

    // Find previously deployed pipeline.
    try {
        DataPipelineClient client = new DataPipelineClient(credentials);

        pipelineToRemoveId = getPipelineId(pipelineFile, client);
        if (!pipelineToRemoveId.isEmpty() && oldPipelineHasRunningTasks()) {
            clientMessages.add("[WARN] Old pipeline is currently running. Execution will be terminated.");
        }
    } catch (DeploymentException e) {
        pipelineToRemoveId = "";
    }

    req.getView(this, "confirm").forward(req, resp);
}

From source file:com.shazam.dataengineering.pipelinebuilder.DeploymentAction.java

License:Apache License

public synchronized void doDeploy(StaplerRequest req, StaplerResponse resp)
        throws ServletException, IOException {
    DataPipelineClient client = new DataPipelineClient(credentials);
    Date start = new Date();
    try {//from w  w w. j  a  v a2  s.  c o m
        String pipelineId = createNewPipeline(client);
        validateNewPipeline(pipelineId, client);
        uploadNewPipeline(pipelineId, client);
        deployScriptsToS3();
        removeOldPipeline(client);
        activateNewPipeline(pipelineId, client);
        writeReport(start, pipelineId, true);
        req.getView(this, "report").forward(req, resp);
    } catch (DeploymentException e) {
        if (e.getCause() != null) {
            clientMessages.add("[ERROR] " + e.getCause().getMessage());
        }
        writeReport(start, "", false);
        req.getView(this, "error").forward(req, resp);
    }
}