Java 类com.amazonaws.services.elasticbeanstalk.model.ApplicationDescription 实例源码

项目:aws-beanstalk-publisher    文件:AWSEBCredentials.java   
public FormValidation doLoadApplications(@QueryParameter("awsAccessKeyId") String accessKey, @QueryParameter("awsSecretSharedKey") String secretKey, @QueryParameter("awsRegion") String regionString) {
    if (accessKey == null || secretKey == null) {
        return FormValidation.error("Access key and Secret key cannot be empty");
    }
    AWSEBCredentials credentials = new AWSEBCredentials("", accessKey, secretKey);
    Regions region = Enum.valueOf(Regions.class, regionString);
    if (region == null) {
        return FormValidation.error("Missing valid Region");
    }

    List<ApplicationDescription> apps = AWSEBUtils.getApplications(credentials.getAwsCredentials(), region);


    StringBuilder sb = new StringBuilder();
    for (ApplicationDescription app : apps) {
        sb.append(app.getApplicationName());
        sb.append("\n");
    }
    return FormValidation.ok(sb.toString());
}
项目:aws-ant-tasks    文件:DeployAppToBeanstalkTests.java   
@After
public void tearDown() throws InterruptedException {
    bcClient.terminateEnvironment(new TerminateEnvironmentRequest()
            .withEnvironmentName(TEST_ENVIRONMENTNAME));
    AWSTestUtils.waitForEnvironmentToTransitionToStateAndHealth(
            TEST_ENVIRONMENTNAME, EnvironmentStatus.Terminated, null,
            bcClient);
    bcClient.deleteApplication(new DeleteApplicationRequest(TEST_APPNAME));
    while (true) {
        DescribeApplicationsResult appResult = bcClient
                .describeApplications();
        boolean appNameFound = false;
        for (ApplicationDescription appdesc : appResult.getApplications()) {
            if (appdesc.getApplicationName().equals(TEST_APPNAME)) {
                appNameFound = true;
                break;
            }
        }
        if (!appNameFound) {
            break;
        }
    }
}
项目:aws-beanstalk-publisher    文件:AWSEBUtils.java   
public static String getApplicationListAsString(AWSEBCredentials credentials, Regions region) {
    AWSCredentialsProvider awsCredentials = null;
    if (credentials != null) {
        awsCredentials = credentials.getAwsCredentials();
    }
    List<ApplicationDescription> apps = getApplications(awsCredentials, region);

    StringBuilder sb = new StringBuilder();
    for (ApplicationDescription app : apps) {
        sb.append(app.getApplicationName());
        sb.append("\n");
    }
    return sb.toString();
}
项目:aws-beanstalk-publisher    文件:AWSEBUtils.java   
public static List<ApplicationDescription> getApplications(AWSCredentialsProvider credentials, Regions region) {
    AWSElasticBeanstalk awseb = getElasticBeanstalk(credentials, Region.getRegion(region));
    DescribeApplicationsResult result = awseb.describeApplications();
    return result.getApplications();
}
项目:awseb-deployment-plugin    文件:AWSEBDeploymentBuilder.java   
public FormValidation doValidateCredentials(
        @QueryParameter("credentialId") final String credentialId,
        @QueryParameter final String awsRegion) {
    for (String value : Arrays.asList(credentialId, awsRegion)) {
        if (value.contains("$")) {
            return FormValidation.warning("Validation skipped due to parameter usage ('$')");
        }
    }

    StringWriter stringWriter = new StringWriter();
    PrintWriter w = new PrintWriter(stringWriter, true);

    try {
        w.printf("<ul>%n");

        w.printf("<li>Building Client (credentialId: '%s', region: '%s')</li>%n", credentialId,
                awsRegion);

        AWSClientFactory factory = AWSClientFactory.getClientFactory(credentialId, awsRegion);

        AmazonS3 amazonS3 = factory.getService(AmazonS3Client.class);
        String s3Endpoint = factory.getEndpointFor((AmazonS3Client) amazonS3);

        w.printf("<li>Testing Amazon S3 Service (endpoint: %s)</li>%n", s3Endpoint);

        w.printf("<li>Buckets Found: %d</li>%n", amazonS3.listBuckets().size());

        AWSElasticBeanstalk
                awsElasticBeanstalk =
                factory.getService(AWSElasticBeanstalkClient.class);

        String
                awsEBEndpoint =
                factory.getEndpointFor((AWSElasticBeanstalkClient) awsElasticBeanstalk);

        w.printf("<li>Testing AWS Elastic Beanstalk Service (endpoint: %s)</li>%n",
                awsEBEndpoint);

        List<String>
                applicationList =
                Lists.transform(awsElasticBeanstalk.describeApplications().getApplications(),
                        new Function<ApplicationDescription, String>() {
                            @Override
                            public String apply(ApplicationDescription input) {
                                return input.getApplicationName();
                            }
                        });

        w.printf("<li>Applications Found: %d (%s)</li>%n", applicationList.size(),
                StringUtils.join(applicationList, ", "));

        w.printf("</ul>%n");

        return FormValidation.okWithMarkup(stringWriter.toString());
    } catch (Exception exc) {
        return FormValidation.error(exc, "Failure");
    }
}
项目:elasticbeanstalk-dashboard    文件:ElasticBeanstalkService.java   
public List<ApplicationDescription> describeApplications(){
    awsElasticBeanstalkAsyncClient.setRegion(region);
    DescribeApplicationsResult result = awsElasticBeanstalkAsyncClient.describeApplications();
    return result.getApplications();
}