本文整理汇总了Java中com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient类的典型用法代码示例。如果您正苦于以下问题:Java AWSElasticBeanstalkClient类的具体用法?Java AWSElasticBeanstalkClient怎么用?Java AWSElasticBeanstalkClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AWSElasticBeanstalkClient类属于com.amazonaws.services.elasticbeanstalk包,在下文中一共展示了AWSElasticBeanstalkClient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public void execute() {
checkParams();
AWSElasticBeanstalkClient bcClient = getOrCreateClient(AWSElasticBeanstalkClient.class);
DescribeEnvironmentsRequest deRequest = new DescribeEnvironmentsRequest()
.withEnvironmentNames(environmentName);
DescribeEnvironmentsResult result = bcClient
.describeEnvironments(deRequest);
if (result.getEnvironments().size() < 1) {
throw new BuildException(
"No environments found with the specified name "
+ environmentName);
}
try {
AWSTestUtils.waitForEnvironmentToTransitionToStateAndHealth(
environmentName, EnvironmentStatus.Ready, null, bcClient);
} catch (InterruptedException e) {
throw new BuildException(e.getMessage());
}
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:20,代码来源:TestSuccessfulBeanstalkDeploymentTask.java
示例2: perform
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
@Override
public boolean perform() throws Exception {
AWSClientFactory factory;
if (null != getDeployerConfig().getCredentials()) {
factory = AWSClientFactory
.getClientFactory(getDeployerConfig().getCredentials(), getDeployerConfig().getAwsRegion());
} else {
factory = AWSClientFactory.getClientFactory("", getDeployerConfig().getAwsRegion());
}
log ("Using region: '%s'", getDeployerConfig().getAwsRegion());
setS3(factory.getService(AmazonS3Client.class));
setAwseb(factory.getService(AWSElasticBeanstalkClient.class));
return false;
}
开发者ID:ingenieux,项目名称:awseb-deployment-plugin,代码行数:19,代码来源:DeployerCommand.java
示例3: collectsEventsFromLiveEnvironment
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
/**
* Environment can collect events from running environment.
* @throws Exception If something is wrong
*/
@Test
public void collectsEventsFromLiveEnvironment() throws Exception {
Assume.assumeThat(EnvironmentTest.AWS_KEY, Matchers.notNullValue());
final AWSCredentials creds = new BasicAWSCredentials(
EnvironmentTest.AWS_KEY,
EnvironmentTest.AWS_SECRET
);
final AWSElasticBeanstalk ebt = new AWSElasticBeanstalkClient(creds);
final Environment env = new Environment(ebt, "e-nxmcbf3pvk");
Logger.info(
this,
"events: %[list]s",
Arrays.asList(env.events())
);
}
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:20,代码来源:EnvironmentTest.java
示例4: deployToEnvironment
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
/**
* Create a new Beanstalk application version using the file on S3 at s3BucketName/s3FileKey.
* Deploy this application version to the Beanstalk environment.
*/
public void deployToEnvironment() {
this.info("Connecting to ElasticBeanstalk");
AWSElasticBeanstalkClient beanstalkClient = new AWSElasticBeanstalkClient(this.mvnArgs.getCredentials());
// create new application version
this.info("Creating new version " + this.mvnArgs.applicationName + "/" + this.mvnArgs.applicationVersion);
S3Location s3Location = new S3Location()
.withS3Bucket(this.mvnArgs.s3BucketName)
.withS3Key(this.mvnArgs.s3FileKey);
CreateApplicationVersionRequest versionRequest = new CreateApplicationVersionRequest()
.withApplicationName(this.mvnArgs.applicationName)
.withVersionLabel(this.mvnArgs.applicationVersion)
.withSourceBundle(s3Location);
CreateApplicationVersionResult versionResult = beanstalkClient.createApplicationVersion(versionRequest);
Util.dump(versionResult, this.mvnArgs.getLog());
// tell the environment to use the new application version
this.info("Updating environment " + this.mvnArgs.environmentName + " with version " + this.mvnArgs.applicationVersion);
UpdateEnvironmentRequest environmentRequest = new UpdateEnvironmentRequest()
.withEnvironmentName(this.mvnArgs.environmentName)
.withVersionLabel(this.mvnArgs.applicationVersion);
UpdateEnvironmentResult envResult = beanstalkClient.updateEnvironment(environmentRequest);
Util.dump(envResult, this.mvnArgs.getLog());
}
开发者ID:pglass,项目名称:awspush-maven-plugin,代码行数:29,代码来源:AWSPush.java
示例5: execute
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public void execute() {
checkParams();
AWSElasticBeanstalkClient client = getOrCreateClient(AWSElasticBeanstalkClient.class);
CreateApplicationRequest request = new CreateApplicationRequest(
applicationName).withDescription(applicationDescription);
System.out.println("Creating application " + applicationName + "...");
try {
client.createApplication(request);
} catch (Exception e) {
throw new BuildException(
"Exception while attempting to create application: "
+ e.getMessage(), e);
}
System.out.println("Application created successfully");
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:16,代码来源:CreateBeanstalkApplicationTask.java
示例6: execute
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public void execute() {
System.out
.println("Terminating environment " + environmentName + "...");
checkParams();
AWSElasticBeanstalkClient bcClient = getOrCreateClient(AWSElasticBeanstalkClient.class);
try {
bcClient.terminateEnvironment(new TerminateEnvironmentRequest()
.withEnvironmentName(environmentName));
} catch (Exception e) {
throw new BuildException("Could not terminate environment "
+ e.getMessage(), e);
}
System.out
.println("The request to terminate the environment has been submitted.");
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:16,代码来源:TerminateBeanstalkEnvironmentTask.java
示例7: waitForEnvironmentToTransitionToStateAndHealth
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public static void waitForEnvironmentToTransitionToStateAndHealth(
String environmentName, EnvironmentStatus state,
EnvironmentHealth health, AWSElasticBeanstalkClient bcClient)
throws InterruptedException {
System.out.println("Waiting for instance " + environmentName
+ " to transition to " + state + "/" + health);
int count = 0;
while (true) {
Thread.sleep(1000 * 30);
if (count++ > 100) {
throw new RuntimeException("Environment " + environmentName
+ " never transitioned to " + state + "/" + health);
}
List<EnvironmentDescription> environments = bcClient
.describeEnvironments(
new DescribeEnvironmentsRequest()
.withEnvironmentNames(environmentName))
.getEnvironments();
if (environments.size() == 0) {
System.out
.println("No environments with that name were found.");
return;
}
EnvironmentDescription environment = environments.get(0);
System.out.println(" - " + environment.getStatus() + "/"
+ environment.getHealth());
if (environment.getStatus().equalsIgnoreCase(state.toString()) == false)
continue;
if (health != null
&& environment.getHealth().equalsIgnoreCase(
health.toString()) == false)
continue;
return;
}
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:40,代码来源:AWSTestUtils.java
示例8: deploysAndReversesWithLiveAccount
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
/**
* Environment can deploy and reverse with a broken WAR file. This test
* has to be executed only if you have full access to AWS S3 bucket, and
* AWS EBT for deployment. The test runs full cycle of deployment and then
* destroying of a new environment. It won't hurt anything, but will
* consume some EBT resources. Be careful.
*
* @throws Exception If something is wrong
*/
@Test
public void deploysAndReversesWithLiveAccount() throws Exception {
Assume.assumeThat(ApplicationTest.AWS_KEY, Matchers.notNullValue());
final AWSCredentials creds = new BasicAWSCredentials(
ApplicationTest.AWS_KEY,
ApplicationTest.AWS_SECRET
);
final AWSElasticBeanstalk ebt = new AWSElasticBeanstalkClient(creds);
final String name = "netbout";
final Application app = new Application(ebt, name);
final File war = this.temp.newFile("temp.war");
FileUtils.writeStringToFile(war, "broken JAR file content");
final Environment candidate = app.candidate(
new OverridingVersion(
ebt,
name,
new OverridingBundle(
new AmazonS3Client(creds),
"webapps.netbout.com",
war.getName(),
war
)
),
name
);
MatcherAssert.assertThat(candidate.green(), Matchers.equalTo(false));
Logger.info(this, "tail report:\n%s", candidate.tail());
candidate.terminate();
}
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:39,代码来源:ApplicationTest.java
示例9: fetchesTailReportFromLiveEnvironment
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
/**
* Environment can fetch TAIL report from live environment.
* @throws Exception If something is wrong
*/
@Test
public void fetchesTailReportFromLiveEnvironment() throws Exception {
Assume.assumeThat(EnvironmentTest.AWS_KEY, Matchers.notNullValue());
final AWSCredentials creds = new BasicAWSCredentials(
EnvironmentTest.AWS_KEY,
EnvironmentTest.AWS_SECRET
);
final AWSElasticBeanstalk ebt = new AWSElasticBeanstalkClient(creds);
final Environment env = new Environment(ebt, "e-2n2mqauqae");
Logger.info(this, "tail report:\n%s", env.tail());
}
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:16,代码来源:EnvironmentTest.java
示例10: BeanstalkDeployer
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public BeanstalkDeployer(String s3Endpoint, String beanstalkEndpoint, AWSCredentialsProvider credentialsProvider) {
s3 = new AmazonS3Client(credentialsProvider);
elasticBeanstalk = new AWSElasticBeanstalkClient(credentialsProvider);
s3.setEndpoint(s3Endpoint);
elasticBeanstalk.setEndpoint(beanstalkEndpoint);
}
开发者ID:EvidentSolutions,项目名称:gradle-beanstalk-plugin,代码行数:7,代码来源:BeanstalkDeployer.java
示例11: getElasticBeanstalk
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public static AWSElasticBeanstalk getElasticBeanstalk(AWSCredentialsProvider credentials, Region region) {
AWSElasticBeanstalk awseb = region.createClient(AWSElasticBeanstalkClient.class, credentials, getClientConfig());
return awseb;
}
开发者ID:DavidTanner,项目名称:aws-beanstalk-publisher,代码行数:5,代码来源:AWSEBUtils.java
示例12: execute
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public void execute() {
checkParams();
AWSElasticBeanstalkClient client = getOrCreateClient(AWSElasticBeanstalkClient.class);
CreateEnvironmentRequest eRequest = new CreateEnvironmentRequest(
applicationName, environmentName)
.withDescription(environmentDescription)
.withVersionLabel(versionLabel)
.withSolutionStackName(solutionStackName);
if (!(tierName == null || tierType == null || tierVersion == null)) {
eRequest.setTier(new EnvironmentTier().withName(tierName)
.withType(tierType).withVersion(tierVersion));
}
if (cnamePrefix != null) {
CheckDNSAvailabilityResult dnsResult = client
.checkDNSAvailability(new CheckDNSAvailabilityRequest(
cnamePrefix));
if (!dnsResult.isAvailable()) {
throw new BuildException("The specified CNAME " + cnamePrefix
+ " was not available");
}
eRequest.setCNAMEPrefix(cnamePrefix);
}
List<ConfigurationOptionSetting> optionSettings = new LinkedList<ConfigurationOptionSetting>();
for (Setting setting : settings) {
optionSettings.add(new ConfigurationOptionSetting(setting
.getNamespace(), setting.getOptionName(), setting
.getValue()));
}
if (optionSettings.size() > 0) {
eRequest.setOptionSettings(optionSettings);
}
System.out.println("Creating environment " + environmentName + "...");
String cNAME = "";
try {
CreateEnvironmentResult result = client.createEnvironment(eRequest);
if ((cNAME = result.getCNAME()) == null) {
System.out
.println("Create environment request submitted. The environment configuration does not support a CNAME.");
} else {
System.out
.println("Create environment request submitted. When the environment is finished launching, your deployment will be available at "
+ cNAME);
}
} catch (Exception e) {
throw new BuildException(
"Exception while attempting to create environment: "
+ e.getMessage(), e);
}
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:52,代码来源:CreateBeanstalkEnvironmentTask.java
示例13: execute
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
public void execute() {
checkParams();
AWSElasticBeanstalkClient bcClient = getOrCreateClient(AWSElasticBeanstalkClient.class);
bcClient.deleteApplication(new DeleteApplicationRequest(applicationName));
}
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:6,代码来源:DeleteBeanstalkApplicationTask.java
示例14: doValidateCredentials
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient; //导入依赖的package包/类
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");
}
}
开发者ID:ingenieux,项目名称:awseb-deployment-plugin,代码行数:59,代码来源:AWSEBDeploymentBuilder.java
注:本文中的com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论