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


Java Deployment类代码示例

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


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

示例1: wasSuccessfulDeployment

import com.amazonaws.services.opsworks.model.Deployment; //导入依赖的package包/类
public static boolean wasSuccessfulDeployment(AWSOpsWorksClient opsClient,
        String deploymentId) {
    while (true) {
        Deployment deployment = opsClient
                .describeDeployments(
                        new DescribeDeploymentsRequest()
                                .withDeploymentIds(deploymentId))
                .getDeployments().get(0);
        if (deployment.getStatus().equalsIgnoreCase("successful")) {
            System.out.println("Deployment " + deploymentId
                    + " was successful");
            return true;
        } else if (deployment.getStatus().equalsIgnoreCase("failed")) {
            return false;
        }
    }
}
 
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:18,代码来源:OpsWorksDeploymentTests.java

示例2: IsDeploymentOfStatus

import com.amazonaws.services.opsworks.model.Deployment; //导入依赖的package包/类
private boolean IsDeploymentOfStatus(String deploymentId, String status) {
	DescribeDeploymentsRequest request = new DescribeDeploymentsRequest()
		.withDeploymentIds(deploymentId);
	
	final DescribeDeploymentsResult result = opsWorks.describeDeployments(request);
	
	for (Deployment deployment : result.getDeployments()) {
		if(!deployment.getStatus().equals(status)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:KabbageInc,项目名称:bamboo-opsworks,代码行数:14,代码来源:OpsWorksService.java

示例3: waitForDeploymentGroupToSucceed

import com.amazonaws.services.opsworks.model.Deployment; //导入依赖的package包/类
/**
 * Waits for a deployment group to succeed
 * 
 * @param deploymentIds
 *            The set of the IDs of the deployments in the group
 * @param client
 *            The client to use to access AWSOpsWorks
 * @throws InterruptedException
 *             If the thread is interrupted
 */
public void waitForDeploymentGroupToSucceed(Set<String> deploymentIds,
        AWSOpsWorksClient client) throws InterruptedException {
    int count = 0;
    while (true) {
        if (deploymentIds.isEmpty()) {
            return;
        }

        Thread.sleep(1000 * 10);
        if (count++ > 100) {
            throw new BuildException(
                    "Deployment never failed or succeeded");
        }

        List<Deployment> deployments = client.describeDeployments(
                new DescribeDeploymentsRequest()
                        .withDeploymentIds(deploymentIds))
                .getDeployments();
        for (Deployment deployment : deployments) {
            String status = deployment.getStatus();
            System.out.println(deployment.getDeploymentId() + " : "
                    + status);
            if (status.equalsIgnoreCase("failed")) {
                throw new BuildException("Deployment "
                        + deployment.getDeploymentId() + " failed");
            } else if (status.equalsIgnoreCase("successful")) {
                deploymentIds.remove(deployment.getDeploymentId());
            }
        }
    }
}
 
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:42,代码来源:IncrementalDeploymentTask.java

示例4: handleTaskExecution

import com.amazonaws.services.opsworks.model.Deployment; //导入依赖的package包/类
@Override
protected GoPluginApiResponse handleTaskExecution(GoPluginApiRequest request) {
    Map<String, Object> response = new HashMap<String, Object>();
    try {
        Map<String, Object> map = (Map<String, Object>) new GsonBuilder().create().fromJson(request.requestBody(), Object.class);

        Map<String, Object> configVars = (Map<String, Object>) map.get("config");
        Map<String, Object> context = (Map<String, Object>) map.get("context");
        Map<String, String> envVars = (Map<String, String>) context.get("environmentVariables");

        String appId = getValue(configVars, "appId");
        String layerId = getValue(configVars, "layerId");
        String noWait = getValue(configVars, "noWaitTrue");

        boolean noWaitValue = (noWait != null && noWait.equals("true"));

        String comment = String.format("Deploy build %s via go.cd", envVars.get("GO_PIPELINE_COUNTER"));
        String revision = envVars.get("GO_REVISION");

        log(String.format("[opsworks] Deployment of [appId=%s] started.", appId));

        OpsWorksClient opsWorksClient = new OpsWorksClient(
            envVars.get(AWS_ACCESS_KEY_ID),
            envVars.get(AWS_SECRET_ACCESS_KEY),
            envVars.get(AWS_DEFAULT_REGION)
        );
        Deployment d = opsWorksClient.deploy(appId, layerId, comment, revision, noWaitValue);

        if (d.getStatus().equals("successful") || noWaitValue) {
            response.put("success", true);
            response.put("message", String.format("[opsworks] Deployment of [appId=%s] completed successfully.", appId));
        } else {
            response.put("success", false);
            response.put("message", String.format("[opsworks] Deployment of [appId=%s] failed.", appId));
        }
    } catch (Exception e) {
        response.put("success", false);
        response.put("message", "[opsworks] Deployment interrupted. Reason: " + e.getMessage());
    }
    return renderJSON(SUCCESS_RESPONSE_CODE, response);
}
 
开发者ID:tispr,项目名称:gocd-opsworks-plugin,代码行数:42,代码来源:OpsWorksGoPlugin.java


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