本文整理汇总了Java中com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest类的典型用法代码示例。如果您正苦于以下问题:Java DescribeAutoScalingGroupsRequest类的具体用法?Java DescribeAutoScalingGroupsRequest怎么用?Java DescribeAutoScalingGroupsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DescribeAutoScalingGroupsRequest类属于com.amazonaws.services.autoscaling.model包,在下文中一共展示了DescribeAutoScalingGroupsRequest类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetAutoScalingGroupDesiredCapacity
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetAutoScalingGroupDesiredCapacity() {
final int desiredCapacity = 5;
final DescribeAutoScalingGroupsResult result = mock(DescribeAutoScalingGroupsResult.class, RETURNS_DEEP_STUBS);
when(result.getAutoScalingGroups().get(0).getDesiredCapacity()).thenReturn(desiredCapacity);
when(amazonAutoScalingClient.describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class))).thenReturn(result);
final String groupName = "testGroupName";
assertThat(awsHelperService.getAutoScalingGroupDesiredCapacity(groupName), equalTo(desiredCapacity));
final ArgumentCaptor<DescribeAutoScalingGroupsRequest> argumentCaptor = ArgumentCaptor.forClass(DescribeAutoScalingGroupsRequest.class);
verify(amazonAutoScalingClient).describeAutoScalingGroups(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getAutoScalingGroupNames().get(0), equalTo(groupName));
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:17,代码来源:AwsHelperServiceTest.java
示例2: testGetPublicDnsForAutoScalingGroupNoInstancesFound
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetPublicDnsForAutoScalingGroupNoInstancesFound() {
String logicalId = "fake-logical-id";
when(autoScalingClient.describeAutoScalingGroups(
new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(logicalId)
)
).thenReturn(
new DescribeAutoScalingGroupsResult()
);
// invoke method under test
List<String> results = autoScalingService.getPublicDnsForAutoScalingGroup(logicalId);
assertEquals(0, results.size());
}
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:19,代码来源:AutoScalingServiceTest.java
示例3: testIncrementMinInstancesForAsgHappy
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testIncrementMinInstancesForAsgHappy() {
String logicalId = "asg id";
String instanceId = "instance id";
int minSize = 2;
when(autoScalingClient.describeAutoScalingGroups(
new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(logicalId))
).thenReturn(
new DescribeAutoScalingGroupsResult()
.withAutoScalingGroups(
new AutoScalingGroup().withInstances(
new Instance().withInstanceId(instanceId))
.withMinSize(minSize)
)
);
autoScalingService.updateMinInstancesForAutoScalingGroup(logicalId, minSize - 1);
verify(autoScalingClient).updateAutoScalingGroup(new UpdateAutoScalingGroupRequest()
.withAutoScalingGroupName(logicalId)
.withMinSize(minSize - 1));
}
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:25,代码来源:AutoScalingServiceTest.java
示例4: findAutoscalingGroups
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
/**
* Returns auto scaling groups that have the CLUSTER_TAG_KEY tag
* @return collection of AutoScalingGroup that contain the CLUSTER_TAG_KEY
*/
private Collection<AutoScalingGroup> findAutoscalingGroups() {
String token = null;
List<AutoScalingGroup> groupList = new ArrayList<>();
do {
DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest();
request.setNextToken(token);
DescribeAutoScalingGroupsResult result = asgClient.describeAutoScalingGroups(request);
result.getAutoScalingGroups().stream()
.filter(a -> containsTag(a.getTags()))
.forEach(groupList::add);
token = result.getNextToken();
} while(!Strings.isNullOrEmpty(token));
return groupList;
}
开发者ID:bbcom,项目名称:turbine-plugins,代码行数:21,代码来源:AsgTagInstanceDiscovery.java
示例5: testGetInstanceIdsForAutoScalingGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetInstanceIdsForAutoScalingGroup() {
final com.amazonaws.services.autoscaling.model.Instance instance = new com.amazonaws.services.autoscaling.model.Instance();
instance.setInstanceId(TEST_INSTANCE_ID);
final List<com.amazonaws.services.autoscaling.model.Instance> instanceList = new ArrayList<>();
instanceList.add(instance);
final DescribeAutoScalingGroupsResult result = mock(DescribeAutoScalingGroupsResult.class, RETURNS_DEEP_STUBS);
when(result.getAutoScalingGroups().get(0).getInstances()).thenReturn(instanceList);
when(amazonAutoScalingClient.describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class))).thenReturn(result);
final String groupName = "testGroupName";
assertThat(awsHelperService.getInstanceIdsForAutoScalingGroup(groupName).get(0), equalTo(TEST_INSTANCE_ID));
final ArgumentCaptor<DescribeAutoScalingGroupsRequest> argumentCaptor = ArgumentCaptor.forClass(DescribeAutoScalingGroupsRequest.class);
verify(amazonAutoScalingClient).describeAutoScalingGroups(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getAutoScalingGroupNames().get(0), equalTo(groupName));
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:21,代码来源:AwsHelperServiceTest.java
示例6: testGetInstancesForAutoScalingGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetInstancesForAutoScalingGroup() {
final com.amazonaws.services.autoscaling.model.Instance instance = new com.amazonaws.services.autoscaling.model.Instance();
instance.setInstanceId(TEST_INSTANCE_ID);
instance.setAvailabilityZone("testZone");
final List<com.amazonaws.services.autoscaling.model.Instance> instanceList = new ArrayList<>();
instanceList.add(instance);
final DescribeAutoScalingGroupsResult result = mock(DescribeAutoScalingGroupsResult.class, RETURNS_DEEP_STUBS);
when(result.getAutoScalingGroups().get(0).getInstances()).thenReturn(instanceList);
when(amazonAutoScalingClient.describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class))).thenReturn(result);
final String groupName = "testGroupName";
assertThat(awsHelperService.getInstancesForAutoScalingGroup(groupName).get(0),
allOf(
hasProperty("instanceId", equalTo(TEST_INSTANCE_ID)),
hasProperty("availabilityZone", equalTo("testZone"))
));
final ArgumentCaptor<DescribeAutoScalingGroupsRequest> argumentCaptor = ArgumentCaptor.forClass(DescribeAutoScalingGroupsRequest.class);
verify(amazonAutoScalingClient).describeAutoScalingGroups(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getAutoScalingGroupNames().get(0), equalTo(groupName));
}
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:26,代码来源:AwsHelperServiceTest.java
示例7: describeAutoScalingGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
private Optional<AutoScalingGroup> describeAutoScalingGroup(final String autoscalingGroupName) {
final DescribeAutoScalingGroupsRequest describeAsg = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(autoscalingGroupName);
final DescribeAutoScalingGroupsResult result = autoScalingClient.describeAutoScalingGroups(describeAsg);
return result.getAutoScalingGroups().stream().findFirst();
}
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:8,代码来源:AutoScalingService.java
示例8: getAutoScalingGroupsWithTag
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
/***
* Get list of {@link AutoScalingGroup}s for a given tag
*
* @param tag Tag to filter the auto scaling groups
* @return List of {@link AutoScalingGroup}s qualifying the filter tag
*/
public List<AutoScalingGroup> getAutoScalingGroupsWithTag(Tag tag) {
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient();
final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest();
final List<AutoScalingGroup> allAutoScalingGroups = autoScaling
.describeAutoScalingGroups(describeAutoScalingGroupsRequest)
.getAutoScalingGroups();
final List<AutoScalingGroup> filteredAutoScalingGroups = Lists.newArrayList();
for (AutoScalingGroup autoScalingGroup : allAutoScalingGroups) {
for (TagDescription tagDescription : autoScalingGroup.getTags()) {
if (tagDescription.getKey().equalsIgnoreCase(tag.getKey()) &&
tagDescription.getValue().equalsIgnoreCase(tag.getValue())) {
filteredAutoScalingGroups.add(autoScalingGroup);
}
}
}
return filteredAutoScalingGroups;
}
开发者ID:apache,项目名称:incubator-gobblin,代码行数:29,代码来源:AWSSdkClient.java
示例9: testGetInstances_awsException
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetInstances_awsException() throws Exception {
when(asgClient.describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class))).thenThrow(new AmazonClientException("Unit Test Intentional Exception"));
Collection<Instance> instanceList = new AsgTagInstanceDiscovery(asgClient, ec2Client).getInstanceList();
assertNotNull(instanceList);
assertTrue(instanceList.isEmpty());
}
开发者ID:bbcom,项目名称:turbine-plugins,代码行数:8,代码来源:AsgTagInstanceDiscoveryTest.java
示例10: createASGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
public AutoScalingGroup createASGroup(CreateAutoScalingGroupRequest request) {
logger.info("create auto scaling group, request={}", request);
autoScaling.createAutoScalingGroup(request);
DescribeAutoScalingGroupsResult result = autoScaling.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(request.getAutoScalingGroupName()));
return result.getAutoScalingGroups().get(0);
}
开发者ID:neowu,项目名称:cmn-project,代码行数:8,代码来源:AutoScaling.java
示例11: listASGroups
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
public List<AutoScalingGroup> listASGroups() {
logger.info("list all auto scaling groups");
List<AutoScalingGroup> asGroups = new ArrayList<>();
String nextToken = null;
while (true) {
DescribeAutoScalingGroupsResult result = autoScaling.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withNextToken(nextToken));
asGroups.addAll(result.getAutoScalingGroups());
nextToken = result.getNextToken();
if (nextToken == null) break;
}
return asGroups;
}
开发者ID:neowu,项目名称:cmn-project,代码行数:13,代码来源:AutoScaling.java
示例12: describeASGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
public AutoScalingGroup describeASGroup(String asGroupName) {
logger.info("describe auto scaling group, name={}", asGroupName);
List<AutoScalingGroup> groups = autoScaling.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(asGroupName))
.getAutoScalingGroups();
if (groups.isEmpty()) return null;
return groups.get(0);
}
开发者ID:neowu,项目名称:cmn-project,代码行数:9,代码来源:AutoScaling.java
示例13: call
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Override
public AutoScalingGroup call() {
DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(this.groupName);
DescribeAutoScalingGroupsResult result = getClient().getApi().describeAutoScalingGroups(request);
List<AutoScalingGroup> autoScalingGroups = result.getAutoScalingGroups();
if (autoScalingGroups.isEmpty()) {
throw new IllegalArgumentException(format("Auto Scaling Group '%s' doesn't exist in region '%s'.",
this.groupName, getClient().getRegion()));
}
return getOnlyElement(autoScalingGroups);
}
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:13,代码来源:GetAutoScalingGroup.java
示例14: resumeAutoScalingPolicies
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
private void resumeAutoScalingPolicies(AuthenticatedContext ac, CloudStack stack) {
for (Group instanceGroup : stack.getGroups()) {
try {
String asGroupName = cfStackUtil.getAutoscalingGroupName(ac, instanceGroup.getName(), ac.getCloudContext().getLocation().getRegion().value());
if (asGroupName != null) {
AmazonAutoScalingClient amazonASClient = awsClient.createAutoScalingClient(new AwsCredentialView(ac.getCloudCredential()),
ac.getCloudContext().getLocation().getRegion().value());
List<AutoScalingGroup> asGroups = amazonASClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(asGroupName)).getAutoScalingGroups();
if (!asGroups.isEmpty()) {
if (!asGroups.get(0).getSuspendedProcesses().isEmpty()) {
amazonASClient.updateAutoScalingGroup(new UpdateAutoScalingGroupRequest()
.withAutoScalingGroupName(asGroupName)
.withMinSize(0)
.withDesiredCapacity(0));
amazonASClient.resumeProcesses(new ResumeProcessesRequest().withAutoScalingGroupName(asGroupName));
}
}
} else {
LOGGER.info("Autoscaling Group's physical id is null (the resource doesn't exist), it is not needed to resume scaling policies.");
}
} catch (AmazonServiceException e) {
if (e.getErrorMessage().matches("Resource.*does not exist for stack.*") || e.getErrorMessage().matches("Stack '.*' does not exist.*")) {
LOGGER.info(e.getMessage());
} else {
throw e;
}
}
}
}
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:31,代码来源:AwsResourceConnector.java
示例15: getInstanceIds
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
public List<String> getInstanceIds(AmazonAutoScalingClient amazonASClient, String asGroupName) {
DescribeAutoScalingGroupsResult describeAutoScalingGroupsResult = amazonASClient
.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(asGroupName));
List<String> instanceIds = new ArrayList<>();
if (describeAutoScalingGroupsResult.getAutoScalingGroups().get(0).getInstances() != null) {
for (Instance instance : describeAutoScalingGroupsResult.getAutoScalingGroups().get(0).getInstances()) {
if ("InService".equals(instance.getLifecycleState())) {
instanceIds.add(instance.getInstanceId());
}
}
}
return instanceIds;
}
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:14,代码来源:CloudFormationStackUtil.java
示例16: describeAutoScalingGroups
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Override
public List<AbstractResource<?>> describeAutoScalingGroups(Account account, Region region, DateTime dt) {
AmazonAutoScaling as = findClient(account, region);
DescribeAutoScalingGroupsRequest req = new DescribeAutoScalingGroupsRequest();
log.debug("start describing auto scaling groups for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
DescribeAutoScalingGroupsResult res = as.describeAutoScalingGroups(req);
return converter.toAsGroups(res.getAutoScalingGroups(), account.getId(), region, dt);
}
开发者ID:veyronfei,项目名称:clouck,代码行数:11,代码来源:AsWrapperImpl.java
示例17: testGetPublicDnsForAutoScalingGroup
import com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest; //导入依赖的package包/类
@Test
public void testGetPublicDnsForAutoScalingGroup() {
String logicalId = "fake-logical-id";
String instanceId = "fake-instance-id";
String dnsName = "dns.name";
when(autoScalingClient.describeAutoScalingGroups(
new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(logicalId)
)
).thenReturn(
new DescribeAutoScalingGroupsResult()
.withAutoScalingGroups(
new AutoScalingGroup()
.withInstances(
new Instance()
.withInstanceId(instanceId)
)
)
);
when(ec2Client.describeInstances(
new DescribeInstancesRequest()
.withInstanceIds(instanceId)
)
).thenReturn(
new DescribeInstancesResult()
.withReservations(
new Reservation()
.withInstances(
new com.amazonaws.services.ec2.model.Instance()
.withPublicDnsName(dnsName)
)
)
);
// invoke method under test
List<String> results = autoScalingService.getPublicDnsForAutoScalingGroup(logicalId);
assertEquals(1, results.size());
assertEquals(dnsName, results.get(0));
}
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:44,代码来源:AutoScalingServiceTest.java
注:本文中的com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论