热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()方法的使用及代码示例

本文整理了Java中com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()

本文整理了Java中com.amazonaws.services.autoscaling.AmazonAutoScaling.describeAutoScalingGroups()方法的一些代码示例,展示了AmazonAutoScaling.describeAutoScalingGroups()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AmazonAutoScaling.describeAutoScalingGroups()方法的具体详情如下:
包路径:com.amazonaws.services.autoscaling.AmazonAutoScaling
类名称:AmazonAutoScaling
方法名:describeAutoScalingGroups

AmazonAutoScaling.describeAutoScalingGroups介绍

[英]Simplified method form for invoking the DescribeAutoScalingGroups operation.
[中]调用DescribeAutoScalingGroups操作的简化方法表单。

代码示例

代码示例来源:origin: aws/aws-sdk-java

/**
* Makes a call to the operation specified by the waiter by taking the corresponding request and returns the
* corresponding result
*
* @param describeAutoScalingGroupsRequest
* Corresponding request for the operation
* @return Corresponding result of the operation
*/
@Override
public DescribeAutoScalingGroupsResult apply(DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest) {
return client.describeAutoScalingGroups(describeAutoScalingGroupsRequest);
}
}

代码示例来源:origin: Netflix/eureka

/**
* Queries AWS to get the autoscaling information given the asgName.
*
* @param asgName
* - The name of the ASG.
* @return - The auto scaling group information.
*/
private AutoScalingGroup retrieveAutoScalingGroup(String asgName) {
if (Strings.isNullOrEmpty(asgName)) {
logger.warn("null asgName specified, not attempting to retrieve AutoScalingGroup from AWS");
return null;
}
// You can pass one name or a list of names in the request
DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(asgName);
DescribeAutoScalingGroupsResult result = awsClient
.describeAutoScalingGroups(request);
List asgs = result.getAutoScalingGroups();
if (asgs.isEmpty()) {
return null;
} else {
return asgs.get(0);
}
}

代码示例来源:origin: Netflix/eureka

DescribeAutoScalingGroupsResult result = autoScalingClient.describeAutoScalingGroups(request);
List asgs = result.getAutoScalingGroups();
if (asgs.isEmpty()) {

代码示例来源:origin: Netflix/Priam

.withAutoScalingGroupNames(
asgNames.toArray(new String[asgNames.size()]));
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);

代码示例来源:origin: Netflix/Priam

.withAutoScalingGroupNames(
asgNames.toArray(new String[asgNames.size()]));
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);

代码示例来源:origin: apache/incubator-gobblin

/***
* 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 getAutoScalingGroupsWithTag(Tag tag) {
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient();
final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest();
final List allAutoScalingGroups = autoScaling
.describeAutoScalingGroups(describeAutoScalingGroupsRequest)
.getAutoScalingGroups();
final List 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;
}

代码示例来源:origin: Netflix/Priam

/** Actual membership AWS source of truth... */
@Override
public int getRacMembershipSize() {
AmazonAutoScaling client = null;
try {
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq =
new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(instanceInfo.getAutoScalingGroup());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
int size = 0;
for (AutoScalingGroup asg : res.getAutoScalingGroups()) {
size += asg.getMaxSize();
}
logger.info("Query on ASG returning {} instances", size);
return size;
} finally {
if (client != null) client.shutdown();
}
}

代码示例来源:origin: Netflix/Priam

@Override
public void expandRacMembership(int count) {
AmazonAutoScaling client = null;
try {
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq =
new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(instanceInfo.getAutoScalingGroup());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
AutoScalingGroup asg = res.getAutoScalingGroups().get(0);
UpdateAutoScalingGroupRequest ureq = new UpdateAutoScalingGroupRequest();
ureq.setAutoScalingGroupName(asg.getAutoScalingGroupName());
ureq.setMinSize(asg.getMinSize() + 1);
ureq.setMaxSize(asg.getMinSize() + 1);
ureq.setDesiredCapacity(asg.getMinSize() + 1);
client.updateAutoScalingGroup(ureq);
} finally {
if (client != null) client.shutdown();
}
}

代码示例来源:origin: msoute/vertx-deploy-tools

private String matchAutoScalingGroupName(String regex) {
DescribeAutoScalingGroupsResult result = awsAsClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest());
List groups = toGroupNameList(result.getAutoScalingGroups());
while (result.getNextToken() != null && !result.getNextToken().isEmpty()) {
result = awsAsClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withNextToken(result.getNextToken()));
groups.addAll(toGroupNameList(result.getAutoScalingGroups()));
}
List matchedGroups = groups.stream().filter(name -> name.matches(regex)).collect(Collectors.toList());
if (matchedGroups == null || matchedGroups.isEmpty() || matchedGroups.size() != 1) {
int matchSize = matchedGroups == null ? -1 : matchedGroups.size();
if (matchedGroups != null && matchSize > 0) {
matchedGroups.forEach(group -> log.error("Matched group : " + group));
}
throw new IllegalStateException("Unable to match group regex, matched group size " + matchSize);
}
return matchedGroups.stream().findFirst().orElse(regex);
}

代码示例来源:origin: com.netflix.eureka/eureka-core

/**
* Queries AWS to get the autoscaling information given the asgName.
*
* @param asgName
* - The name of the ASG.
* @return - The auto scaling group information.
*/
private AutoScalingGroup retrieveAutoScalingGroup(String asgName) {
if (Strings.isNullOrEmpty(asgName)) {
logger.warn("null asgName specified, not attempting to retrieve AutoScalingGroup from AWS");
return null;
}
// You can pass one name or a list of names in the request
DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(asgName);
DescribeAutoScalingGroupsResult result = awsClient
.describeAutoScalingGroups(request);
List asgs = result.getAutoScalingGroups();
if (asgs.isEmpty()) {
return null;
} else {
return asgs.get(0);
}
}

代码示例来源:origin: msoute/vertx-deploy-tools

public AutoScalingGroup getAutoScalingGroup() {
DescribeAutoScalingGroupsResult result = awsAsClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(activeConfiguration.getAutoScalingGroupId()));
if (result.getAutoScalingGroups().isEmpty()) {
log.error("No Autoscaling group found with id : " + activeConfiguration.getAutoScalingGroupId());
throw new IllegalStateException();
}
return result.getAutoScalingGroups().get(0);
}

代码示例来源:origin: com.elastisys.scale/cloudpool.aws.commons

@Override
public AutoScalingGroup call() {
DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(this.groupName);
DescribeAutoScalingGroupsResult result = getClient().getApi().describeAutoScalingGroups(request);
List 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);
}

代码示例来源:origin: com.netflix.dynomitemanager/dynomitemanager-common

@Override
public List getRacMembership() {
AmazonAutoScaling client = null;
try {
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(envVariables.getRack());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
List instanceIds = Lists.newArrayList();
for (AutoScalingGroup asg : res.getAutoScalingGroups()) {
for (Instance ins : asg.getInstances())
if (!(ins.getLifecycleState().equalsIgnoreCase("Terminating")
|| ins.getLifecycleState().equalsIgnoreCase("shutting-down")
|| ins.getLifecycleState().equalsIgnoreCase("Terminated")))
instanceIds.add(ins.getInstanceId());
}
logger.info(String.format("Querying Amazon returned following instance in the ASG: %s --> %s",
envVariables.getRack(), StringUtils.join(instanceIds, ",")));
return instanceIds;
} finally {
if (client != null)
client.shutdown();
}
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-aws

/***
* 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 getAutoScalingGroupsWithTag(Tag tag) {
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient();
final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest();
final List allAutoScalingGroups = autoScaling
.describeAutoScalingGroups(describeAutoScalingGroupsRequest)
.getAutoScalingGroups();
final List 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;
}

代码示例来源:origin: org.apache.gobblin/gobblin-aws

/***
* 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 getAutoScalingGroupsWithTag(Tag tag) {
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient();
final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest();
final List allAutoScalingGroups = autoScaling
.describeAutoScalingGroups(describeAutoScalingGroupsRequest)
.getAutoScalingGroups();
final List 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;
}

代码示例来源:origin: com.atlassian.buildeng/ecs-scheduler

/**
*
* @param autoScalingGroup name
* @return described autoscaling group
* @throws ECSException
*/
@Override
public AutoScalingGroup describeAutoScalingGroup(String autoScalingGroup) throws ECSException {
try {
AmazonAutoScaling asgClient = AmazonAutoScalingClientBuilder.defaultClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(autoScalingGroup);
List groups = asgClient.describeAutoScalingGroups(asgReq).getAutoScalingGroups();
if (groups.size() > 1) {
throw new ECSException("More than one group by name:" + autoScalingGroup);
}
if (groups.isEmpty()) {
throw new ECSException("No auto scaling group with name:" + autoScalingGroup);
}
return groups.get(0);
} catch (Exception ex) {
if (ex instanceof ECSException) {
throw ex;
} else {
throw new ECSException(ex);
}
}
}

代码示例来源:origin: com.netflix.dynomitemanager/dynomitemanager-common

/**
* Actual membership AWS source of truth...
*/
@Override
public int getRacMembershipSize() {
AmazonAutoScaling client = null;
try {
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(envVariables.getRack());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
int size = 0;
for (AutoScalingGroup asg : res.getAutoScalingGroups()) {
size += asg.getMaxSize();
}
logger.info(String.format("Query on ASG returning %d instances", size));
return size;
} finally {
if (client != null)
client.shutdown();
}
}

代码示例来源:origin: com.netflix.dynomitemanager/dynomitemanager-common

/**
* Cross-account member of AWS
*/
@Override
public int getCrossAccountRacMembershipSize() {
AmazonAutoScaling client = null;
try {
client = getCrossAccountAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(envVariables.getRack());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
int size = 0;
for (AutoScalingGroup asg : res.getAutoScalingGroups()) {
size += asg.getMaxSize();
}
logger.info(String.format("Query on cross account ASG returning %d instances", size));
return size;
} finally {
if (client != null)
client.shutdown();
}
}

代码示例来源:origin: com.netflix.raigad/raigad

@Override
public void expandRacMembership(int count)
{
AmazonAutoScaling client = null;
try
{
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(config.getASGName());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
AutoScalingGroup asg = res.getAutoScalingGroups().get(0);
UpdateAutoScalingGroupRequest ureq = new UpdateAutoScalingGroupRequest();
ureq.setAutoScalingGroupName(asg.getAutoScalingGroupName());
ureq.setMinSize(asg.getMinSize() + 1);
ureq.setMaxSize(asg.getMinSize() + 1);
ureq.setDesiredCapacity(asg.getMinSize() + 1);
client.updateAutoScalingGroup(ureq);
}
finally
{
if (client != null)
client.shutdown();
}
}

代码示例来源:origin: com.netflix.dynomitemanager/dynomitemanager-common

@Override
public void expandRacMembership(int count) {
AmazonAutoScaling client = null;
try {
client = getAutoScalingClient();
DescribeAutoScalingGroupsRequest asgReq = new DescribeAutoScalingGroupsRequest()
.withAutoScalingGroupNames(envVariables.getRack());
DescribeAutoScalingGroupsResult res = client.describeAutoScalingGroups(asgReq);
AutoScalingGroup asg = res.getAutoScalingGroups().get(0);
UpdateAutoScalingGroupRequest ureq = new UpdateAutoScalingGroupRequest();
ureq.setAutoScalingGroupName(asg.getAutoScalingGroupName());
ureq.setMinSize(asg.getMinSize() + 1);
ureq.setMaxSize(asg.getMinSize() + 1);
ureq.setDesiredCapacity(asg.getMinSize() + 1);
client.updateAutoScalingGroup(ureq);
} finally {
if (client != null)
client.shutdown();
}
}

推荐阅读
  • 本文详细探讨了 org.apache.hadoop.ha.HAServiceTarget 类中的 checkFencingConfigured 方法,包括其功能、应用场景及代码示例。通过实际代码片段,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 深入解析ESFramework中的AgileTcp组件
    本文详细介绍了ESFramework框架中AgileTcp组件的设计与实现。AgileTcp是ESFramework提供的ITcp接口的高效实现,旨在优化TCP通信的性能和结构清晰度。 ... [详细]
  • 探讨ChatGPT在法律和版权方面的潜在风险及影响,分析其作为内容创造工具的合法性和合规性。 ... [详细]
  • 采用IKE方式建立IPsec安全隧道
    一、【组网和实验环境】按如上的接口ip先作配置,再作ipsec的相关配置,配置文本见文章最后本文实验采用的交换机是H3C模拟器,下载地址如 ... [详细]
  • 深入解析SpringMVC核心组件:DispatcherServlet的工作原理
    本文详细探讨了SpringMVC的核心组件——DispatcherServlet的运作机制,旨在帮助有一定Java和Spring基础的开发人员理解HTTP请求是如何被映射到Controller并执行的。文章将解答以下问题:1. HTTP请求如何映射到Controller;2. Controller是如何被执行的。 ... [详细]
  • 深入解析 Android IPC 中的 Messenger 机制
    本文详细介绍了 Android 中基于消息传递的进程间通信(IPC)机制——Messenger。通过实例和源码分析,帮助开发者更好地理解和使用这一高效的通信工具。 ... [详细]
  • 访问一个网页的全过程
    准备:DHCPUDPIP和以太网启动主机,用一根以太网电缆连接到学校的以太网交换机,交换机又与学校的路由器相连.学校的这台路由器与一个ISP链接,此ISP(Intern ... [详细]
  • 本文详细介绍了Java库XChart中的XYSeries类下的setLineColor()方法,并提供了多个实际应用场景的代码示例。 ... [详细]
  • 本文详细介绍了如何在Java中使用org.apache.xalan.templates.AVTPartSimple类,并提供了多个实际的代码示例,帮助开发者更好地理解和运用这一类。 ... [详细]
  • 反向投影技术主要用于在大型输入图像中定位特定的小型模板图像。通过直方图对比,它能够识别出最匹配的区域或点,从而确定模板图像在输入图像中的位置。 ... [详细]
  • Kubernetes 持久化存储与数据卷详解
    本文深入探讨 Kubernetes 中持久化存储的使用场景、PV/PVC/StorageClass 的基本操作及其实现原理,旨在帮助读者理解如何高效管理容器化应用的数据持久化需求。 ... [详细]
  • 在创建新的Android项目时,您可能会遇到aapt错误,提示无法打开libstdc++.so.6共享对象文件。本文将探讨该问题的原因及解决方案。 ... [详细]
  • 本文介绍了一个SQL Server自定义函数,用于从字符串中提取仅包含数字和小数点的子串。该函数通过循环删除非数字字符来实现,并附带创建测试表、存储过程以演示其应用。 ... [详细]
  • 本文探讨了如何在Classic ASP中实现与PHP的hash_hmac('SHA256', $message, pack('H*', $secret))函数等效的哈希生成方法。通过分析不同实现方式及其产生的差异,提供了一种使用Microsoft .NET Framework的解决方案。 ... [详细]
  • 本文详细介绍了Java中实现异步调用的多种方式,包括线程创建、Future接口、CompletableFuture类以及Spring框架的@Async注解。通过代码示例和深入解析,帮助读者理解并掌握这些技术。 ... [详细]
author-avatar
咖喱2502894907
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有